regex for url & email ??

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

regex for url & email ??

Post by PHPycho »

Hello forums!!
I need a very good validation for "url" and "email" using regular expression.
Following are the criteria for url:
* may have http or https @ start
* may or may not have www.
* may or may not have query string like ?action=a&pack=p
* may also support for country level domain

Following are the criteria for email:
* info@example.com
* info.us@example.com
* info@example.net.au
* info.us@example.net.au
* may support above formats
Note: regex syntax should be valid for both php and javascript
Any suggestions, comments are warlmy welcome
Thanks in advance to all..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

We have discussions of both fairly regularly. Have you found those threads?
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

Post by PHPycho »

Knock Knock
Calling for suggestion again..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Tap, tap... waiting for you to look up pre-existing threads.....
Post Reply