Regular Expression Coach - gHacks Tech News

Regular Expression Coach

Regex Coach is a free cross-platform program that you can use to learn and work with regular expressions in a visual environment.

Regular expression can be used to identify strings of text. They are written in a formal language that looks hard to understand on first glance but follows strict rules. Most users associate regular expressions with programming languages, and while this is surely a dominant area, regular expressions are supported in text editors and other tools as well. One of the most popular is probably grep in Linux.

Regex Coach

regular expression coach

Regex Coach is an excellent software program to learn regular expressions using a graphical user interface and real-time results directly in the interface.

The interface itself is divided into two display panes: the first acts as an editor for regular expressions, the second holds a sample text which highlights matches based on the regular expression entered in the first. You can paste sample text into the second pane, or type it instead.

Below those two panes are tabs and buttons that provide additional functionality.

To test a regular expression, you'd do the following. You add a sample text to the target string field via copy and paste or by typing it directly.

Once the text is there, you add the regular expression. The program highlights matches automatically as you type which makes it easy to craft the right expression for the sample text. When you edit the regular expression or the text, results are automatically adjusted as well.

regular expressions

Invalid entries are displayed automatically as a status message. The program will for instance notify the user if a bracket has not been closed which would make the expression invalid.

Verdict

What I like about the program in particular is the info field. It explains the regular expression that you have entered so that you can adjust it based on that as well.

The remaining tabs are also useful. Tree divides the expression into different parts, the replacing and splitting text options act like Perl's substitution and split operators, and the step tab allows you to see the regular expression at work.

The Regex Coach is a learning by doing tool for learning or verifying regular expressions. There is still need for a documentation on regular expressions like this one.

While it is useful to learn regular expressions, it can also be used to debug expressions or create new ones that include testing to make sure they work properly.

If you prefer to use an online tool, or are not using Windows, then you may want to try RegExr, a free service that offers a similar feature set but online.

Summary
software image
Author Rating
1star1star1star1star1star
no rating based on 0 votes
Software Name
Regex Coach
Operating System
Windows
Software Category
Development
Landing Page




  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Mark Sanborn said on April 14, 2009 at 7:51 pm
      Reply

      Speaking of Perl saving the day, you can create a regular expression with 9 lines of Perl code.

      #!/usr/bin/perl
      while () {
      chomp;
      if (/YOUR_REGULAR_EXPRESSION_GOES_HERE/) {
      print “Matched: |$`$’|\n”;
      } else {
      print “No match: |$_|\n”;
      }
      }

    2. Mohamed Shafi said on April 15, 2009 at 6:28 am
      Reply

      There is another similar one . You can find it here

      http://gskinner.com/RegExr/

      This has both an online and desktop version. I use this.

    3. Kane said on April 15, 2009 at 3:57 pm
      Reply

      Mohamed Shafi: Thanks. This one works a little better for someone with very little regex experience.

    Leave a Reply