View Single Post
 
Old July 22nd, 2008, 08:06 AM
iamrakesh22 iamrakesh22 is offline
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am not good at regular expressions, but try the following

^(\w\[?)([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))(\[?)$

Its the simplest format!

Original reg. expression was

^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$

I tried to modify it slightly to match your requirement.
Somebody who is good at reg. exp. can update it to be more accurate :-)

- Rakesh