Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Expand email reg exp to allow only ; delimiter

Posted on 2004-11-23
3
Medium Priority
?
260 Views
Last Modified: 2010-04-17
I use the Regular Expression
([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)
resourced from  http://www.regexlib.com which works great.

I want to adapt  this to vlidate a sctring of emailaddress delinited by ;. So it would pass
 a@dummy.com
&
 a@dummy.com;b@dummy.com
 but not
a@dummy.com,b@dummy.com

So an optional [;] but how I can I ensure no other delimiters?

Thanks, Tom.
0
Comment
Question by:boardtc
2 Comments
 
LVL 1

Accepted Solution

by:
Ortokobold earned 150 total points
ID: 12663117
^(?:([\w\-\.]+@(?:(?:(?:\d{1,3}\.){3}\d{1,3})|(?:[\w\-]+\.[a-zA-Z]{2,4})))(?:$|\;))+

- The most important part is: (?:$|\;) . I just make sure that each e-mail address ends with EOL or ';' delimeter.
- \w is the word character: [a-zA-Z_0-9]
- \d is the digit character: [0-9]
- I use (?:X) as a non-capturing group. Remove all "?:" strings to get more readable (but also slower and more memory-consuming) version.
0
 

Author Comment

by:boardtc
ID: 12753521
Thanks for the post. Unfortunately the regex falvour I use (TRegExpr for Delphi - http://regexpstudio.com/) gives the error : TRegExpr(comp): Unrecognized Modifer (pos 33) I'm not sure if it's the interval quantifier which it does not support.
I contacted the author a week ago but he has not replied...is there an alternative this might support?

Cheers, Tom.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question