Regex101.com for visualizing and sharing regular expressions


I got an email from somebody named Lindrian about the article I had written about using regular expressions to find comments in source code: ostermiller.org/findcomment.html  Lindrian sent me a link explaining how he had made improvements to the regular expressions I had used: regex101.com/r/wI3fU3

In addition to picking out comments, he also used the regular expression to pick out string literals.   Then capturing groups are used to differentiate between the two.  This is very similar to the way that a lexer would tokenize a source code file as the first stage of parsing.

The most interesting thing to me was that Lindrian had created the regex101.com website to be able to discuss regular expressions like this.  The site is very nifty.  It allows the input of a regular expression and some test text.  It then shows an analysis of how the regular expression matches the test text along with the output.

Leave a comment

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