Donation Goal
Donate Now Goal amount for this year: 799 USD, Received: 100 USD (13%)
Please donate to help support this website. The funds will be used to purchase owned license of LiteSpeed Web Server Enterprise (2-CPU). It provides superior performance in terms of raw speed, scalability and anti-DDoS capabilities.

Testing, Decoding and Analyzing Regular Expressions or RegEx

Posted By Raymond In Category: Computer // Music

Jan
21
2009

Have you ever wonder how does people easily extract emails or some part of information from a file or website? An example is whenever I organize a software giveaway, one email is considered as one entry. I can’t be copying and pasting thousand over emails one by one, so what I did was use regular expressions to search for an email string and extract it to a file.

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.

online regular expressions analyzer

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 Regular Expression Analyzer

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.

[ Download Expresso v3.0 ]


Related posts:
  • Faster and Easily Upload Suspicious Files to ThreatExpert for Analyzing
  • Analyzing Windows Crash Dump or Minidump with WhoCrashed
  • Register and get a Live.com or localized Live account
    • dino

      its usefull though~

      thx ray~

    • utkarsh30june

      Thanks Raymond :)

    • hooly

      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 $$$.

    • Firas

      Thank you Ray :-)

    • bahirzaheri8

      Thanks Ray

    • webcadre

      why putting $$$ if you can have one for free :)

    • hyena

      Thanks, that really expands my abilities, plus saves me so much time.
      Very interesting and enjoyable to read your Tutorials each day, thanks Raymond .

    • damian

      Hi Raymond,
      please can you decrpt this MD5 since im going through a seperation and im sure wife has been having an affair and shes trying to take to the cleaners – thanks for your help in advance

      pls email me with password

      e051d9ef580744a17798dfa1585b6922

    • Eric

      Hi Raymond,
      please can you decrpt this MD5 since im going through a seperation and im sure wife has been having an affair and shes trying to take to the cleaners – thanks for your help in advance

      pls email me with password

      1176ba245c05e4f064bd8d7a7a39c2d8

    • http://HiRaymond Rob

      Can you or someone please help with this, the code is b864d69d84eb1a271a13c31fb442fe40
      Thanks Rob

    • http://HiRaymond Rob

      Can you or someone please help me decode this for facebook, Thanks everyone. My email is etownconcrete420@aol.com if you can find the password please email me Thanks again
      b864d69d84eb1a271a13c31fb442fe40

    Copyright © 2005-2012 - Raymond.CC Blog