Try
sfValidatorRegex(array('pattern' => '/^[0-9]{8}$/'))
^ = beginning
$ = end
Note: I'm no regex guru and I have not tested the above, so finger crossed.
On Thu, Mar 19, 2009 at 6:25 PM, John Masson <[email protected]> wrote:
>
> Hey All,
>
> Trying to do some VERY simple regex validation to check for an 8 digit
> number (no more, no less), but having some issues...
>
> This:
> sfValidatorRegex(array('pattern' => '/[0-9]{8}/'))
>
> Validates the first 8 characters to make sure they are digits, and
> accepts 8 digits as it should, but lets you put ANYTHING after those 8
> digits... more numbers, letters, whatever.
>
> This:
> sfValidatorRegex(array('pattern' => '[0-9]{8}'))
>
> Doesn't seem to let anything through...
>
> At a bit of a loss as using some online regex testers shows either of
> these to be ok, but Symfony doesn't like it??
>
> Any ideas?
>
> Thanks,
> John
> >
>
--
Blue Horn Ltd - System Development
http://bluehorn.co.nz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---