Live data from Hacker News

RegEx101.com now offers a debugger

regex101.com

1–10 of 35 posts

Re: RegEx101.com now offers a debugger

#4
post #2

Would be ultra-cool if you could propose a "generate a matching sample" button.

I have thought about this, but in cases where it would be useful, it's impossible to generate a sample match string. For example, creating a match string for /(?:a|[bc])efg?/ is super simple, but for something like: /(ab(?1)*)/ it becomes much harder. Not to mention the performance hit you would see for these more complex expressions. (These are just dummy expressions for illustrative purposes, but I'm sure you get my gist.)

Re: RegEx101.com now offers a debugger

#5
That's funny. Just yesterday I needed that and used pythex and a bunch of other similar 'testers' to make sure my regular expression was good. It was, but it somehow didn't work on the Mozilla Add-On Builder.

After asking a question on the #jetpack channel, members have spotted the mistake: The regex was correct, but it needed to "match the exact string" as mentioned on the doc. I've read it, but didn't understand that point. There was a missing "." at the beginning and the end. So /.regex.*/

Thanks for putting this.

Re: RegEx101.com now offers a debugger

#6
http://rubular.com/ is also really great! I use it often when programming ruby regular expressions. Fill in a batch of test strings into the box, then run your regular expression against it, and instantly see (visually) what is happening. This is a BIG plus coming from perl regex 10 years ago ;) This is not a dig a perl regex, but I just remember it was a trial and error loop, where I would continually be iterating the script to see if it worked, where as with this webpage, you just iterate, more quickly.

They also have a great example:

  test string:
  Today's date is: 9/28/2013.

  regex:
  (?\d{1,2})\/(?\d{1,2})\/(?\d{4})

  result:
  month	9
  day	28
  year	2013
Screenshot here: http://i.imgur.com/ixyHRde.png
Post reply on HN