First timer - easy question (I think)

0 views
Skip to first unread message

Jeff

unread,
Sep 22, 2009, 10:05:15 PM9/22/09
to Regex
Never used preg_match in php before, but it's time to "dive in".

My first need is to test name fields and ensure that there are only
letters, spaces, a hyphen, and/or an apostrophe.

So I know I need
[a-zA-z], but how do I also allow ' and - as a part of the permitted
characters?

Thanks!

Accmailer

unread,
Sep 25, 2009, 3:40:39 AM9/25/09
to Regex
Hi Jeff,
put the apostrophe right before the closing square bracket and the
hyphen right after the opening square bracket.

Regards

Eugeny

Jeff Riedl

unread,
Sep 25, 2009, 6:35:21 AM9/25/09
to re...@googlegroups.com
Accmailer wrote:
Hi Jeff,
put the apostrophe right before the closing square bracket and the
hyphen right after the opening square bracket.

Regards

Eugeny
  
Thanks!

--
Jeff
Reply all
Reply to author
Forward
0 new messages