[thelist] PHP- simple reg-ex has me stumped

Stephane Gosselin stef at cfusions.com
Wed May 8 04:11:08 CDT 2002


This matches a string that can contain any alphanumeric caracters , the
dash and the underscore.

^[a-zA-Z0-9\/_/-]+$

  Now. I got that far. I fail to understand the \ right after the 9, is it
same as |, the 'or' operator?
  I need the same regex above to simply accept spaces....i have tried all
kinds of /s /s. \s \s,[spaces]... etc

This regex: ^[a-zA-Z0-9\s.\-]+$ , wich has to be close to solving my
problem works good on http://regxlib.com/RETester.aspx?regexp_id=63
  BUT fails in my php script with the ereg function, also tried preg_match,
no go. What s the prob?
--> ANy addtional links to docs or man pages would be appreciated. Thnks.


* My regex makes my tip. :)

<Tip>
PHP - Reg EX:
This matches a string that can contain any alphanumeric caracters , the
dash and the underscore.
^[a-zA-Z0-9\/_/-]+$
<\Tip




More information about the thelist mailing list