Hello Hans,

Thanks for the welcome. :)

Okay, I use PCRE type functions for regular expressions so I think I can continue using them without worrying about the speed.

Yes, I never thought if i had to support a different character sets. Thanks for pointing out the possibilities.

Sincerely,
Yogesh



Hans Zaunere wrote:
Hi,

  
This is my first post to this NYPHP mailing list. So hello to everyone
and thanks for the thorough discussions which help a beginner developer
like me.
    

Hi Yogesh and welcome.

  
I have a simple question. I want to validate first and last name. I
assume that these are probably most common fields in any type of
registration forms on websites.

When I validate these fields, I can't use ctype_alpha since these don't
allow ' as in O'Reilly or Last Name with white space in it. I have to
use a regular _expression_ here. That's fine and I use it as well. Another
method is to find a single ' or space,  trim it and then validate
remaining alphabet characters. RegEx is slower and even in new
filter_input, there is no way to validate these field types.
    

I wouldn't worry too much about the speed of regex (I'd recommend pcre_*
functions).

  
Is there any other way to validate first and last names. It will be nice
to have have inbuilt function for such commonly used field types. I will
like to know how people tackle these issue.
    

But note that validating is all relative.  What if you need to support
various charsets?  I typically just check for strings without newlines and
non-printable chars.  For international sites, obviously, there are some
other loops involved.

H


_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation
  
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to