regex help please

Results 1 to 2 of 2

Thread: regex help please

  1. #1
    Join Date
    Dec 1969

    Default regex help please

    I have the following regex and am not sure its working correctly:<BR><BR>"^[A-z0-9.?s]$",$_POST[&#039;ad_text&#039;]<BR><BR>where the posted values are alphnumeric, and period, question mark and whit space? Is this correct?<BR><BR>TIA

  2. #2
    Join Date
    Dec 1969

    Default Big bug in that!

    When you do<BR> [A-z]<BR>you are getting all the characters *AFTER* Z [upper case] and *BEFORE* a [lower case] as legal! Those characters are<BR> [ ] ~ _ ` [last is the back-tick, usually on same key as ~]<BR><BR>You *must* specify the letter ranges seperately:<BR> [A-Za-z]<BR>(or you can tell the regexp to ignore case.<BR><BR>Further, the RegExp you used will allow exactly *ONE* character, only.<BR><BR>If you want to allow one or more such characters it should be<BR> ^[A-Za-z0-9.s?]+$<BR><BR>

Posting Permissions

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