James Ray Anderson

James Ray Anderson
James Ray Anderson
0 comments

Regular Expressions

1:48 PM
Every now and again I come across situations where I need to utilize the power of Regular Expressions to validate data entry. Here are some handy links and information to help you.

Here are some regular expressions that I have used in the past:

Computer Name: [0-9a-zA-Z_-]
Email Address: \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
Web URL: http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
Phone Number (US): ((\(\d{3}\) ?)(\d{3}-))?\d{3}-\d{4}
Social Security Number: \d{3}-\d{2}-\d{4}
Postal Code (zip +4): \d{5}(-\d{4})?

There is an extensive resource of very handy regular expressions:
http://regexlib.com/

0 comments:

 
Toggle Footer
Top