Building regular expressions

When my testing gets technical, there are a lot of things that I only have to grapple with infrequently. Regular expressions are one of those in-again, out-again things for which my expertise varies depending on when you ask me. Today’s Ruby hacking saw me find RegExr which helps you build and test regular expressions, as well as having a lot of ready-to-go samples built into it.  You can also download it as an Air application if you need it locally.

I always seem to end up at regularexpressions.info as well to get help, but had issues with their regular expression tester today.  While the bugs were a hassle, it helped me in a way, because testing your regular expressions with a few different regular expression testers is always a good idea if you think you might need to use them in multiple environments or tools.

Coupled with JEdit or Ruby, regular expressions are a powerful part of your tester toolkit.

What other tools for regular expressions are you using?

3 comments on “Building regular expressions”

  1. Consider http://www.rubular.com as a learning and testing tool.

    Cheers,

    —Michael B.

  2. Jared says:

    Nice. A bit sluggish on my (slow) notebook, but being Ruby-based is a plus.

  3. Teemu Vesala says:

    Sometimes I have to do lot of searching from logs or modify the data from format to another. (E.g. collect the data for tests from the real logs so log format has be modified to Excel or some other ‘tabular’ format.) In those cases I use Perl. It has strong capabilities for text handling. E.g. if I had log with lines:

    Jan 01 2010;http://google.fi/;ERROR;406 bytes
    Jan 01 2010;http://google.com/;OK;506 bytes

    and I wanted to get only succeeded lines and their sizes it’d be about (non-tested, so has bugs and is very lazy way done…;):

    while () {
    if (s/* [0-9][0-9] [0-9][0-9][0-9][0-9];(http.*);OK; ([0-9]+) bytes/) {
    print “$1,$2”;
    }
    }

    result would be:
    http://google.com/,506

    which is easy to import to Excel.

Leave a Reply

Your email address will not be published. Required fields are marked *