From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@india.com Date: Fri, 14 Nov 2014 13:00:33 +0000 From: trebol@india.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] e0|e01 on regexp(3) Topicbox-Message-UUID: 28109ece-ead9-11e9-9d60-3106f5b1d025 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.