RSS

Introduction to Regular Expressions

May 5, 2007    (Click to Rate!) Loading ... Loading ...

Technology


Mastering Regular Expressions

Mike Malone put up an excellent introduction to Regular Expressions that I think anyone that is rusty or curious should take a look at. He took the most basic concepts in regexp and introduces you to them in such a way that you could probably accomplish 80% of the matching you would need to without further reading.

The topics Mike covers are:

  • The Line Anchors: ^ and $
  • The Character Class: []
  • The Character Class Metacharacter: -
  • Matching Any Character With a Dot: .
  • The Alternation Metacharacter: |
  • Matching Optional Items: ?
  • The Other Quantifiers: + and *
  • The Interval Quantifier: {}
  • The Escape Character: \
  • Using Parenthesis for Matching: ()

I know in the past when I’ve dabbled in regular expressions it’s always been hit-or-miss until I got matching what I wanted, but I never really understood them, or I would understand just enough to finish what I was working on. I think most developers don’t acknowledge the importance of regular expressions or the power of them.

A plugin for Eclipse 3.x that I’ve been using to test regular expressions recently that I find to be excellent is the “Eclipse Regular Expression Tester” plugin. Here is an online one for folks that don’t use Eclipse.

Share This on Your Favorite Social Network:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Fark
  • Propeller
  • Reddit
  • Technorati
  • StumbleUpon
  • DZone
  • MisterWong
  • TwitThis
  • Slashdot
  • SphereIt
, , ,

This post was written by:

Riyad Kalla - who has written 1696 posts on The “Break it Down” Blog.

"Ultimately I just want to provide a resource that folks find useful."

4 Comments For This Post

  1. Stephan Says:

    Thank you for mentioning the Eclipse RegEx Tester plugin. I’m happy you found it useful.

  2. Riyad Kalla Says:

    Stephan,
    It’s fantastically helpful. We were really in a jam working on a regular expression and being able to have that handy plugin installed and just change things on the fly and see the real-time evaluation was very very slick.

    Thank you for the effort to put this out there and just keep it easy to pick up and quick to use.

  3. nirbhay Says:

    what is the regular expretion for website name like http://www.xyz.com

  4. Riyad Kalla Says:

    nirbhay,
    I think this thread might be helpful and give you what you are looking for.

Leave a Reply