Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi, I'm the author of this page. This tool has a lot of complexity in it and a huge number of corner-cases. If you discover any bugs or XSS vulnerabilities, feel free to let me know.


This is fantastic, thanks for sharing it.

I wish I had it when I was a CS professor in 2004-2006, teaching Compilers to 2nd year university students. They would have found it really useful.


I'm having trouble with backtracking and groups. It's possible I'm doing something wrong, but

    [bc]*(cd)+
doesn't seem to match

    cbcdcd
Nor does the simpler

    a*(ab)
match

    aab
But

    a*ab
matches aab.


You found a bug. The bug was: When I was computing the animation frames for the visual, after a backtracking event, I forgot to restore the 'progress' values for the PROGRESS nodes to what they were before the stack push took place. I think I fixed this issue, and I just pushed an update which should appear any second when the cache invalidates.


Cool! Thanks for looking at it/fixing it.

P.S. The whole split() thing you do is an interesting hack to not have to preserve/rewind so much state. :D I've never quite seen fork() used so...


I tried using this expression:

   ^((?:(?:https?|ftps?):\/\/)|irc:\/\/|mailto:)([\w?!~^\/\\#$%&'()*+,\-.\/:;<=@]*[\w~^\/\\#$%&'()*+,\-\/:;<=@])  
and it seems to fail to visualize it.


The (?:stuff) part is for a non-capturing group which I didn't add support for. Maybe in the near future. That would be one of the easiest features to add since the tool also doesn't support backreferences yet.

Edit: Actually, since the non-capturing group part doesn't add much here, you can just remove the '?:'s and this works:

https://blog.robertelder.org/regular-expression-visualizer/?...


The first one that I tried also failed for the same reason, FWIW. Cool tool! :)


That's really impressive work. What flavor of regular expressions do you follow there?


I tried to follow a middle-of-the-road works mostly everywhere made up flavour. Here is a grammar for it:

https://blog.robertelder.org/regular-expression-parser-gramm...

I may add to it in the future if there is enough interest. At the moment it doesn't support a few common things like word breaks and backreferences, but I don't think it'd be too hard to add.


Any chance of open sourcing it so we can contribute some regex features to your awesome project? :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: