Tuesday, March 20, 2007

RegExp... Express your strings !

‘Regular Expression’ is powerful concept of describing the format of string and validating (i.e. matching) the string based on expression. This is supported by most of programming/scripting languages, and notably well suppported by Perl, Python, all languages on .NET platform, Java and Javascript. This concept has gone beyond the programming language and new text editors or IDE have started giving support for regular expression for Search/Find text and Replace text, but regular expression is best used for validating user input on client side (using javascript) in web applications.

Lot of people know about Regular Expression but do not use them when required. This is because it's more complex and time comsuming to write at begging. But when you mast the underlying comcepts, it's all done.

Here are some good links that you can use in day to day life of a programmer.

  1. If you are using firefox browser this extension is for you: https://addons.mozilla.org/firefox/2077/
  2. Regular expression Tester: http://www.regextester.com/
    • This is online tester for regular expression. It accepts more than one input and validated results immediately in result window as you change you expression. This is my favorite for writing regular expression.
  3. http://regexlib.com/default.aspx : This is library for regular expressions. Most probably you will find the one you want.
  4. http://www.regular-expressions.info : Excellent in details tutorial for regular expressions.
  5. http://www.evolt.org/article/Regular_Expressions_in_JavaScript/17/36435/ : Quick reference. A good article to refer after having basic knowledge about regular expression.
  6. Have you thought about having text editor with support for regular expression for finding and replacing the string? SciTE is the powerful, lightweight text editor which has support for regular expression along with lots of other useful features. Go to http://scintilla.sourceforge.net/SciTERegEx.html to see how work with regular expression in SciTE.
Enjoy expressing your strings!!

2 comments:

Vaibhav Choudhary said...
This comment has been removed by the author.
Vaibhav Choudhary said...

Wow, good links ! Java is also supporting Regular expression like you said. There is something called class Pattern :). I love to use that class, because thinking of reg. expression for even a simple thing is a tough job. One use which I thought to make from reg. expression is checking coding standards though it not 100 percent feasible but we are trying to make it as soon as possible:)

http://blogs.sun.com/vaibhav/entry/pattern_class