21 Jan
A regular expression (regex or regexp for short) is a special text string for describing a search pattern. You can think of regular expressions as wildcards on steroids. You are probably familiar with wildcard notations such as *.txt to find all text files in a file manager. The regex equivalent is .*\.txt$.
Regular expressions can be also used in online forms to make sure you submit the correct information. You can write a regular expressions to check for the correct email format, phone number where it uses all digits/numbers and etc. I was trying to fill up a form but no matter how I tried, the form wouldn’t accept the phone number format. When I viewed the HTML source code, I found that it uses regular expressions to check for the valid phone number format. Sounds easy but analyzing how regular expression works is not easy. After a little research, I found 2 ways that is able to decode and explain the analyzed regular expressions.
Below is an example of regular expressions. I am sure you are now scratching your head like what I did when I saw this. I couldn’t understand a thing about regex syntax below. I didn’t want to waste my time in learning about regular expressions syntax because I seldom use it and I will end up forgetting them some day.
^0(6[\\s-]?[1-9]\\d{7}|[1-9]\\d[\\s-]?[1-9]\\d{6}|[1-9]\\d{2}[\\s-]?[1-9]\\d{5})$
What I need is an analyzer that is able to analyze regular expressions and let the computer decode the expression to display its elements in plain English. You can either use the online Regular Expressions Analyzer which don’t require downloading or installing any software. Just paste the regular expression syntax to the box and click Parse. The parser will parse it on the fly and produce a tree like representation.

Another method is to use Expresso, a free regular expression development tool that includes an Analyzer. Expresso displays this analysis in the Regex Analyzer as an expandable tree structure. The Analyzer updates automatically whenever the Regex changes. By selecting a node in the tree, you will highlight that portion of the regular expression. In addition to helping you understand the expression, this can be used to highlight text that you want to modify with the Builder or to run a Partial Match.

Expresso is free but you’ll have to register in order to remove the reminders to register your copy. Registration is free. Just enter your name and email and you’ll get your personalized User Name and Registration Code. I am sure you will now be able to understand the regular expressions more easily with Expresso and online regular expression analyzer without actually learning it.
Technorati Tags: search, regular, expressions, expresso, analyze
: Copying this article to your website is strictly NOT allowed. However, if you like this article, you can use the HTML code below to directly link to this article.
Search a Particular Word in Multiple Editable Text Files Graphical User Interface That Works for Nmap Windows Decoding Percent with Numbers Encoding (%20) in URLs Easily and Automatically Keep Your Software Setup Installers Up-To-Date Cheapest domain names Analyzing Windows Crash Dump or Minidump with WhoCrashed Find Out Who is Hosting Website With .CO.CC
Have computer technical problems? Get FREE help from Raymond.CC FORUM
7 Responses for "Testing, Decoding and Analyzing Regular Expressions or RegEx"
its usefull though~
thx ray~
Thanks Raymond
RegexBuddy by jgsoft.com is another good tool for this. $$ though, unfortunately.
if you’re interested in a full-power search tool using regular expressions, and RegexBuddy for that matter, have a look at jgsoft’s PowerGREP: very powerful, but also $$$.
Thank you Ray
Thanks Ray
why putting $$$ if you can have one for free
Thanks, that really expands my abilities, plus saves me so much time.
Very interesting and enjoyable to read your Tutorials each day, thanks Raymond .
Leave a reply