From: trebol@india.com
To: 9fans@india.com
Subject: [9fans] e0|e01 on regexp(3)
Date: Fri, 14 Nov 2014 13:00:33 +0000 [thread overview]
Message-ID: <db3d1508ae67897d7430cf40918dffef@india.com> (raw)
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.
reply other threads:[~2014-11-14 13:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db3d1508ae67897d7430cf40918dffef@india.com \
--to=trebol@india.com \
--cc=9fans@india.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).