5 ms·
There are three types of regex as far as I know: basic (aka GNU), extended and PERL. Grep uses GNU as the name implies. egrep or grep -E uses extended. PERL
by sglane 9y ago
There are three types of regex as far as I know: basic (aka GNU), extended and PERL. Grep uses GNU as the name implies.
egrep or grep -E uses extended. PERL is used elsewhere like JavaScript. Typically you'll see pcre which is the library for Perl Compatible Regular Expressions.
- 1wd 9y agoThere are many differencese between "compatible" regular expressions, for (many) examples read the end of section "Important Notes About Lookbehind" on [1] or compare 24 dialects on [2] for example. [1] http://www.regular-expressions.info/lookaround.html http://www.regular-expressions.info/lookaround.html [2] http://www.regular-expressions.info/refadv.html http://www.regular-expressions.info/refadv.html
- macintux 9y agoErlang requires doubling up on escape backslashes, which generally causes me grief even after I flail about and finally remember it. Subtleties abound.
- pjtr 9y agoAnother strange one is the (old) Visual Studio syntax with its :i (actually often quite helpful) and $1 instead of \1 (even in the new syntax). https://msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.110)....
- jwilk 9y agoThe name "grep" is unrelated to GNU. According to The Jargon File, the etymology is: from the qed/ed editor idiom g/re/p, where re stands for a regular expression, to Globally search for the Regular Expression and Print the lines containing matches to it In fact, grep predates the GNU project by almost a decade. Also, it's the first time I hear about "GNU" regexps.
- sglane 9y agoThanks, just learned something new. grep predates GNU by about a decade it seems.
- Hello71 9y agoa more accurate term would be "BRE with GNU extensions", e.g. \(\)