RegexMagicRegexMagic

Generate Regular Expressions as Loose or as Strict as You Like

When creating regular expressions, you often have to choose between creating fast and simple regular expressions, or complex and accurate regular expressions. When using a regex to search for dates, should the regular expression make sure to exclude February 30th, or is anything in the form of 99/99/99 acceptable? The answer will depend on your goals. Validating user input usually requires an exact regex. Scanning large amounts of data is often better done with a simple regex to save time, particularly if you can trust the data to be valid already.

In the past, people would often settle for simple regexes. It just takes too much time to spell out everything character by character as the regex syntax requires.

With RegexMagic, creating an accurate regex is just as easy as creating a simple one. RegexMagic's patterns provide a wide range of options to specify exactly what you want. The screen shot to the right shows how one simple integer pattern yields a rather long regular expression to match a number between 42 and 2552, and nothing else. Notice the option at the bottom that is set to "strict".

The next screen shot shows what happens if you set that same option at the bottom of the Match panel to "loose". RegexMagic now generates a much shorter regex. Instead of strictly matching numbers between 42 and 2552, the new regex simply matches numbers with 2 to 4 digits. The other two available options (not shown) are "average" and "none".

Since RegexMagic makes it so easy to generate strict regular expressions, you'll do that most of the time. But when combining multiple patterns, you may end up with a regex that's too complex for your target application to handle fast enough. That's when you'll dial RegexMagic down to "average" or "loose". Or, you may be working with a tool or programming language that only supports a simple regex flavor. Then you may need to use the "none" option, which only uses elementary regular expression features.

Easily Create Regexes with RegexMagic

      
Only US$ 39.95
Windows 98, ME, NT4, 2000, XP, Vista, 7, and 8
100% satisfied or money back
free trial download

Generating a strict regular expression
Generating a strict regular expression

Generating a loose regular expression
Generating a loose regular expression