Web Analytics Made Easy -
StatCounter Validating whether string contains llegal chars - CodingForum

Announcement

Collapse
No announcement yet.

Validating whether string contains llegal chars

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validating whether string contains llegal chars

    Could someone please give me a code that will check if a string contains only numerical and alphabetical characacters in it..
    ya know..

    abcedfghijklmnopqrstuvwxyz
    1234567890
    Last edited by avelonx; Jun 30, 2002, 08:19 AM.

  • #2
    PHP Code:
    $str 'lkdsaglfkgslfkjagsd';
    if (
    preg_match('/[^\\dA-Za-z]/'$str)) {
      die(
    'illegal characters!');

    - Mark
    [ AstroBoy Online | Experiments in Stuff | Google, use it! ]

    Comment

    Working...
    X