Solved

Generate Regex tool

Posted on 2011-09-28
5
405 Views
Last Modified: 2012-05-12
Hi Experts,

  In many times I need to work with Regex from simple to complex. I would like to know is there any free tool there to generate regex? I tried Regulazy but which is not given what I expected.

Say for example if I give text as easwaran.p@abc.com the Email regex should be given.

Any help is much appreciated. Thanks in advance.

Regards,
Easwaran.
0
Comment
Question by:Easwaran Paramasivam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36716856
My guess is that deciphering what you want to match exactly (i.e. a literal string vs. a pattern) is a non-trivial task, which is why you don't see many such tools. You might try RegExr, which allows you to see real-time results as you type. You might at least get a feel for what particular regex constructs are doing if you see what they match for every change in your pattern.
0
 
LVL 4

Expert Comment

by:ricovox
ID: 36717349
There are several very nice tools for this.

The best one is probably RegexMagic, which costs $40  http://www.regexmagic.com/

Another tool that is great for designing and testing a regex is  RegexBuddy  http://www.regexbuddy.com/
0
 
LVL 4

Expert Comment

by:ricovox
ID: 36717442
Easwaran,

Your example is actually a bad one, because it is notoriously difficult to find a regex that will verify all valid email addresses. The reason is that the specification of "an email address" is actually very complex, once you start to consider all the possibilities. Here is some more info about that:

As an example, here is a regex that can verify 99.99% of all valid email addresses:
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b

As you can see, it is quite complicated. A simpler one (that matches only about 98-99% of all email addresses) is this one:  \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

You can of course find even simpler ones, but they either let in more invalid addresses or they exclude more valid ones. Both situations are bad.
0
 
LVL 4

Accepted Solution

by:
ricovox earned 500 total points
ID: 36717474
Here is a more detailed explanation about email address regex's:
http://www.regular-expressions.info/email.html

And here is a page that lists many common regex's:
http://www.regular-expressions.info/examples.html

Using a well-known regex that is already developed is really the best way to go. That way you know it is tested and you are not missing any scenarios.

If you try to do it the way you are currently attempting (e.g. by entering in an example text and having a program generate the regex) means you may be missing many possibilities that you won't think of for the examples.

But Good luck, and I hope it all works out for you!
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 36812703
Thanks for your info.
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 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