Sunday, November 28, 2010

Re: Common Punctuation

Off the top of my head:

/^[\-\.a-zA-Z]+$/

Regex is probably the easiest approach. Just set it as a custom
validation rule.

On Nov 28, 1:30 pm, "Dave Maharaj" <m...@davemaharaj.com> wrote:
> I know its not so much Cake question so forgive me ahead of time.
>
> But does anyone know a regex for common punctuation? I want to put
> validation on my "City" field where it's a-z and also allow ' - and . City
> should not have any numbers. Open to any other ideas that you have used also
> as I hate regex. I do not want people putting in crazy fake names. Almost
> impossible to verify the name they enter (imagine that db table of every
> possible name of every city / town in the world) so I would like to ensure
> its within the realm of being real.
>
> St.Louis has (.)
>
> St.John's (.  And ' )
>
> And other have the - separating words of the name. Cant think of any else?
> Any help would be great.
>
> Thanks,
>
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: