* [9fans] e0|e01 on regexp(3)
@ 2014-11-14 13:00 trebol
0 siblings, 0 replies; only message in thread
From: trebol @ 2014-11-14 13:00 UTC (permalink / raw)
To: 9fans
Using a little script I wrote to rename files, I encounter a funny
behavior with '|'. If the regular expressions share a part, doesn't
matter the order of those, The first match from the start of the input
is processed. Now that I'm writing this, it's seems obviously the
right behavior (and I think it is), for example:
% echo '123' | sed s'/12|12/o/g'
o3
% echo '123' | sed s'/23|12/o/g'
o3
But in large concatenations with strange characters like in:
$ echo '__-' | sed s'/_-|_-_|-_|__+ ... and a lot of more cra* ... /__/g'
You could expect the output be '__', but it's '__-'
So... if you are a retard like me, don't try to be such smart and use
various sed commands.
trebol.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-14 13:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 13:00 [9fans] e0|e01 on regexp(3) trebol
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).