Validation ?????

Results 1 to 3 of 3

Thread: Validation ?????

  1. #1
    Sid Guest

    Default Validation ?????

    Hello<BR><BR>I just can&#039;t remeber how to do this and can&#039;t find what i want in the FAQ&#039;s etc<BR><BR>I need to check the value of a text field and only allow a-z 0-9 and . or _ so it should be summit like<BR><BR>/[a-zA-Z0-9]/g<BR><BR>But i can&#039;t remeber how to code it can anyone help ????????<BR><BR>Cheers<BR>Sid

  2. #2
    Dan Evans Guest

    Default RE: Validation ?????

    Rather handily, the w means [a-zA-Z0-9_] so that saves you a few keypresses. . represents the ".", the + means you must have at least one character and the ^ and $ makes it check the entire string for a match. For more details on Regular Expressions try...<BR><BR><BR><BR>& #060;script&#062;<BR>var str = "Dan_Evans_is_no.1"; <BR>alert(str.match(/^[w.]+$/g));<BR>&#060;/script&#062;<BR><BR>Hope this helps,<BR><BR>-Dan Evans

  3. #3
    Sid Guest

    Default RE: Validation ?????

    Thanks Dan it works a treat.....<BR>Don&#039;t know why i can never remember how to code that.<BR><BR>Cheers<BR>Simon

Posting Permissions

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