Problem with regex order
June 18, 2008 4:03 PM
Subscribe
RegExFilter: Can any regular expression ninjas help me with my this teensy problem?
I'm validating an input in cakephp as follow:
'rule' => array('custom', '/^[a-zA-Z\'&.\s]{1,40}$/')
It works great in that it allows letters, spaces, ampersand, apostrophe, period and numbers.
For example: Jim's Number 1 Tackle & Rod Shop. validates.
The problem arises when there is a number first, for example 2you delivery services will not validate.
I know it has something to do with the order in which the expression is written, but I can't figure it out. Anyone know what I'm doing wrong?
Thanks, as always.
posted by ReiToei to computers & internet (6 comments total)
posted by ReiToei at 4:08 PM on June 18, 2008