[thelist] php - regexp help

Edwin Horneij ed_horneij at yahoo.com
Thu Sep 23 18:14:56 CDT 2004

--- Paul Bennett <paul at web-business-pack.com> wrote:

> Basically I want to accept a-z (upper and lower case), spaces, full 
> stops ('periods' for our US readers ;) ) and apostrophes.
> I can get the first 3 to work but can't seem to get an apostrophe 
> through the regexp.
> This is the code:
> if (!preg_match ("/^[A-Za-z \'\.]+$/", $creditcard_holder))
>     {
>     # alert user
>     }
> also any GOOD regexp resources or tutorials would be welcome, the
> stuff I have found is either too basic or too advanced....

I just tested your code on my machine and it works fine. Perhaps the
problem is in the string you are feeding to the regex.

As far as references go, Jeffry Friedl's _Mastering Regular
Expressions_ is _the_ book on the subject.

Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now. 

More information about the thelist mailing list