Re: validate names with regex
| From: | John W. Holmes | Date: | Thu, 13 Nov 2003 01:45:54 +0000 |
| Subject: | Re: validate names with regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169417@lists.php.net to get a copy of this message | ||
Chris W. Parker wrote:
CPT John W. Holmes <mailto:holmes072000@charter.net>Would probably be better to use \w, but best overall to just use preg_match(). The preg_* functions are faster than the ereg* functions...on Wednesday, November 12, 2003 2:09 PM said:I'm wondering two things: 1. Is there a performance difference between ereg() and eregi()? I'm thinking it might be better to change [a-z] to [\w].$match = "^[a-z]+([- ]{1}|(\\\'))?[a-z]+$";along with eregi(), but it can (should) be easily adapted to a syntax compatible with preg_match().
I looked through 40 pages of archives and couldn't find it either. :) It had to deal with validating an entire name and capitalizing it with the whole McNab vs MacNab vs O'Reilly vs Marco de Blabla or whatever. If I find it, I'll forward it your way. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.comI remember a large discussion about this a while back. Archives may be useful.I couldn't find anything, but I was pretty sure it had been discussed before as well. Happen to know the subject of the thread?