Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 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; 06-30-2002 at 02:19 PM.

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Sydney, NSW, Australia
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $str 'lkdsaglfkgslfkjagsd';
    if (
    preg_match('/[^\\dA-Za-z]/'$str)) {
      die(
    'illegal characters!');

    - Mark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •