Data Validation
corliss at alaskapm.org
corliss at alaskapm.org
Thu Jan 27 12:01:45 CST 2000
Greetings:
I was recently talking to some people off list about using regexes for data
validation. I thought this was a good topic for the list, too, though, so I'm
asking for your thoughts: what are your favourite regexes to use for common
data types?
Here's a few that I use often:
e-mail: /^[\w\.]+\@[\w\.-]+\.\w{2,3}$/
telephone: /^(\(?\d{3}\)?[\s-]?)?\d{3}[-\s]?\d{4}$/
zip code: /^\d{5}(-\d{4})?/
Anyone have any other nifty ones to share?
--Arthur Corliss
Perl Monger/Alaska Perl Mongers
http://www.alaskapm.org/
=================================================
Mailing list info: If at any time you wish to (un|re)subscribe to
the list send the request to majordomo at hfb.pm.org. All requests
should be in the body, and look like such
subscribe anchorage-pm-list
unsubscribe anchorage-pm-list
More information about the Anchorage-pm
mailing list