In the case of GNU Sed, the stated reason appears to be
I was afraid it fell into one of those 'cracks'...though from
what was said at the time, some part of the work was already
done and it looked like a matter of docs and packaging...
(though, I admit, in Computer Sci, the last 10% of the work
often takes 90% of the time...
As my substitution needs have become more complex, using perl -pe becomes preferable to sed -e. In particular, being able to use perlcharacter classes and the quantifiers is more concise than the hoops I need to jump through for sed.
I could use [0-9] instead of [[:digit:]] and [A-Za-z] instead of [[:alpha:]], but a) both of those are longer than the perl equivalents and b) [A-Za-z] will match non-ASCII characters like the perl equivalents can.
bosses-r-dum> echo 'å' | sed -e 's/[A-Za-z]/X/'
å
bosses-r-dum> echo 'å' | perl -CS -pe 's/\w/X/'
X
bosses-r-dum>
If you have to deal with unicode, being able to add a flag and have things "Just Work" is very handy. I tend to grow my regexp's organically, so using the same tool for 'simple' and 'complex' regexp's makes sense because my 'simple' regexp can easily turn into a 'complex' one if/when requirements change and I don't need to do any tooling changes (change all [x]\{#\} instances into [x]{#} and the like).
Work-around:
You can use the Pathological Eclectic Rubbish Lister:
or inline replace:
This works for the cases where I use
sed
. If things get more complicated I write a small python script.BTW, I switched to No Shell-Scripting
In the case of GNU Sed, the stated reason appears to be
See GNU bug report logs - #22801 status on committed change: upgrading 'sed' RE's to include perlRE syntax - or search the sed-devel Archives for "PCRE" if you want more details.
Don't forget you can use
perl
itself for many of the simple one-liners for which you might want to use PCRE insed
.As my substitution needs have become more complex, using
perl -pe
becomes preferable tosed -e
. In particular, being able to useperl
character classes and the quantifiers is more concise than the hoops I need to jump through forsed
.vs
I could use
[0-9]
instead of[[:digit:]]
and[A-Za-z]
instead of[[:alpha:]]
, but a) both of those are longer than the perl equivalents and b)[A-Za-z]
will match non-ASCII characters like the perl equivalents can.If you have to deal with unicode, being able to add a flag and have things "Just Work" is very handy. I tend to grow my regexp's organically, so using the same tool for 'simple' and 'complex' regexp's makes sense because my 'simple' regexp can easily turn into a 'complex' one if/when requirements change and I don't need to do any tooling changes (change all
[x]\{#\}
instances into[x]{#}
and the like).Personally I found it easier to do in Python than Perl or Sed.
full example