RegExr
regexr.com
regexr.com
But I've found all of the following to be useful:
https://www.regular-expressions.info/
http://www.cheatography.com/davechild/cheat-sheets/regular-e...
http://eloquentjavascript.net/09_regexp.html
http://www.smashingmagazine.com/2009/06/essential-guide-to-r...
http://www.smashingmagazine.com/2009/05/introduction-to-adva...
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid...
http://codylindley.com/techpro/2013_05_14__javascript-regula...
try regex101 and you won't look back.
Regexper will render your regular expression as a friggin' railroad diagram!! It's extremely handy when debugging your regex or to understand those super complex, multiline regexes, that someone has posted to Stack Overflow.
Both regular-expressions.info and rexegg.com are incredibly good explanations of Regular Expressions.
regular-expressions.info is even available as a PDF e-book against a tip of your choice.
https://ia902309.us.archive.org/25/items/pdfy-MgN0H1joIoDVoI...
(For some reason RegExr.com is submitted to HN much more often than regex101.com. Is there a compelling advantage to RegExr that I've overlooked?)
I’m a big fan.
It looks like regex101 has it as well, but the regexr one is straight to the point (at least for me). https://i.imgur.com/Hg9jGOa.png
I am not associated with this company in any way, just a long time user.
2017 https://news.ycombinator.com/item?id=13599952
2015 https://news.ycombinator.com/item?id=9581225
2014 https://news.ycombinator.com/item?id=7537189
Already in 2008 the comments were listing others: https://news.ycombinator.com/item?id=277657
I'd like to see experiments in alternatives that provide this. It could help do for RegEx's what SQL's WITH statement did for long SQL statements.
Backus–Naur Form could act as a starting point, but it needs some syntactic adjustments to make it more compact and practical, in my opinion. Partial example:
Side = VarFunc + Segment*;
Segment =
":" + Varfunc
| (":" + VarFunc)[0..1] + "{" + "}"
| (":" + Varfunc)[0..1] + "{" + Base + (";" + Base)* + "}";
Letter = ('a'..'z'|'A'..'Z');
ForbiddenChar = $anyChr("/?#%");
/*
Legend:
[x..y] = quantity of repeats (substitute letters with integers)
[0..n] = zero, one, or multiple
* = shorthand for [0..n]
| = "or"
+ = concatenation, ignores white-space
++ = concatenation, excludes white space
+w+ = concatenation, must have white-space between
'x'..'y' = character falls within range
$x() = special function or constant, where "x" is a name.
*/Though if you had to do enough work with text, my bet is that you'd eventually figure out why regexes won. They are simple, straightforward, and just enough to tackle the occasional matching problem on your way to doing something else.
(not to be confused with named capture groups)
You can see it in use here: https://github.com/b0o/quicktemplate.vim/blob/master/syntax/...
See for example Peg.js, LPEG (lua), etc. However, PEGs don't natively permit left recursion (note: some PEG implementations do add that on). If that's a problem, Earley parsers are a nice alternative.
Example of a calculator using Peg.js:
start
= additive
additive
= left:multiplicative "+" right:additive { return left + right; }
/ multiplicative
multiplicative
= left:primary "*" right:multiplicative { return left * right; }
/ primary
primary
= integer
/ "(" additive:additive ")" { return additive; }
integer "integer"
= digits:[0-9]+ { return parseInt(digits.join(""), 10); }If there is a major news item involving regular expressions, we’re all ready to pounce, ala: https://xkcd.com/208/
Not only does it tell you what everything means, but it visually displays it in a way that just makes sense.
I found the pacing to be excellent, with complimentary exercises and that it was educational as both a cheatsheet and a coherent text. Learned a lot from it, despite being experienced from the outset.
Actually I use it for all platforms, and it works most of the time. If I notice that something is odd because the regex engine is different, then I'll use something else. But I really value Rubular's UI simplicity.
It generates clear graphs from regular expressions making immediately clear what they do.
Great for reading monstrous regexes or sharpening my regex skills.
this should be preferred over `a-z` as the latter relies on users locale.