PHP Classes

Validate Regular Expression

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Validate Regular Expression  >  (Un) Subscribe thread alerts  
Subject:Validate Regular Expression
Summary:Validate Reqgular Expression Help
Messages:2
Author:James
Date:2010-02-22 07:45:22
Update:2010-02-22 21:01:49
 

  1. Validate Regular Expression   Reply   Report abuse  
Picture of James James - 2010-02-22 07:45:22
I'm trying to allow only lower and upper case letters, space, hyphen, apostrophe, and grave accent using:
"ValidateRegularExpression"=>"^[a-zA-Z '-`]+$",
"ValidateAsNotEmpty"=>1,

What am I missing to make this work?

Thanks

  2. Re: Validate Regular Expression   Reply   Report abuse  
Picture of James James - 2010-02-22 21:01:49 - In reply to message 1 from James
Nevermind...

I needed a refresher on posix regular expressions, forgot to escape the literal....

"ValidateRegularExpression"=>"^[a-zA-Z '-`]+$"

should be

"ValidateRegularExpression"=>"^[a-zA-Z '\-`]+$"