News for hackers. Stuff that matters.
Re:Sculpting text with regex, grep, sed, awk, emacs and vim ... by shmerl on Tuesday July 29, 2014 @01:37AM (#8100854)
I prefer pcregrep, it's more feature rich and syntax is much neater. Using \d instead of [0-9] and etc. makes regexes more readable.
Re:Sculpting text with regex, grep, sed, awk, emacs and vim ... by chubot on Tuesday July 29, 2014 @02:00AM (#8100906)
Is that any different than grep --perl (should be available most places GNU grep is)? I use that for complex regexes.

For even longer ones I just started using perl with /x, so you can uses insignificant whitespace and comments.

Re:Sculpting text with regex, grep, sed, awk, emacs and vim ... by shmerl on Tuesday July 29, 2014 @02:53AM (#8101005)
I didn't really compare, since grep marks --perl as "highly experimental". pcregrep on the other hand is around for a long time already.

One very useful feature in pcregrep is outputting the matched subpattern only. For example if you do:

    echo 'abcdefg' | pcregrep -o2  'a(bc)d(ef)g'
It will output only second matched subpattern.
Re:Sculpting text with regex, grep, sed, awk, emacs and vim ... by oweiler on Tuesday July 29, 2014 @01:56AM (#8100891)
And depending on the context makes them wrong. \d is not equivalent to [0-9].
Re:Sculpting text with regex, grep, sed, awk, emacs and vim ... by shmerl on Tuesday July 29, 2014 @02:44AM (#8100987)
Not only if it uses different locales. Normally it is equal to [0-9]. Don't even start on Unicode and regexes.