[thelist] RegExp for name validation...

jsWalter jsWalter at torres.ws
Mon Dec 15 18:42:11 CST 2003


> -----Original Message-----
> From: Andrew Seguin [mailto:asegu at borg.darktech.org]
> Sent: Monday, December 15, 2003 6:01 PM
> To: jsWalter at torres.ws; thelist at lists.evolt.org
> Subject: Re: [thelist] RegExp for name validation...
>
>
> ok, I won't ask why...

thank you   ;)


> nor can I quickly offer a complete solution...

hey, no problem. Any ideas in any direction is better than where I am right
now.


> but, why not...
> 1-why not split into more then one ereg? Validate your rules a couple at a
> time?
>   $name = "a-sample n'me"
>   if (
>        ereg("([a-z...<allowedChars>]) ([a-z...<allowedChars>])", $name)
>     && ereg(...)
>   ) /*Then valid name*/ else /*invalid name*/

mmm, so, validate if string contains any "authorized" characters first.

Then see if "patterns" are proper for detail validation.

hadn't thought of it that way...


> 2-Could the name be input taken as two(more?) parts? does it have to come
> in as one string? I'm thinking here that you could always leave it up to
> the user to decide what they want to show up as first/last name.

First, Middle, Last is of no consequence to this.

This would be a simple" checker, not really a parser to pull fields out of a
string.


> Of course their could be a good reason to do take it in as a single string
> (maybe going through a text file or what not)...

This is for a GPG web-based system. We are adding the GPG plug-in to an
existing system, so we can not modify the use interface to ask for user
data. We need to use what we get and we get...

    Name: _________________


> ..so extension of point 2... could the regular expressions be kept strict
> and user confirmation if regular expressions are unable to process
> properly? Cause I'm thinking that you might end up with problems in other
> cultures names where maybe it could be acceptable to have multiple
> apostrophes within...

Yes, I thought of that. Not sure how to handle that, really. But that's why
I'm adding the extended characters to the rules, to allow for other
non-English names.


> or maybe they might want to write their name as
> 'last_name', 'first name'...

again, not really interested in what is FIRST, LAST, Middle, etc, just
trying to make sure they don't insert a number or some punctuation in there.

And, because of security protocols, we are to defined *allowed* characters,
not defined *disallowed* characters. The first is really a small sub-set,
and easier to define and secure.


> At this point... I'm thinking a good PhD in computer science - natural
> language processing could start to be of use ;)

Yes, well, I missed that day in school, so I'm going taking the plunge and
asking this august group.


> Good luck on your (intriguing, I'll admit) quest for your name matching
> regular expression.

Thanks for your help and ideas.

I hope I clarified a few things.

I know you gave me more to think on.

Thanks

Walter




More information about the thelist mailing list