Wednesday, April 25, 2018

Regular Expression Tester

On a regular basis (pun intended), I am using regular expressions for simple parsing tasks. Writing or debugging a regular expression is not always super easy. I found that web site [1] is quite helpful to experiment with regular expressions and input strings.

Using the default prce (php) flavor


Groups captured are color coded

The tools supports different flavors (I suspect pcre (php) is the most "standard"). Indeed this version checks out my regexp. However when using the javascript version, I see:

No match with Javascript flavor
With the pcre (php) there is even a debugging tool which explains in detail how the regexp algorithm proceeds:

Debugger


References


  1. Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript, https://regex101.com/

No comments:

Post a Comment