bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26409: plus (`+`) not a metacharacter with --posix option, escaped o


From: Jordan Torbiak
Subject: bug#26409: plus (`+`) not a metacharacter with --posix option, escaped or not
Date: Sat, 8 Apr 2017 18:37:15 -0600

The plus character can't seem to be used as a metacharacter when both the
`-E` and `--posix` options are given.

This works as expected:

$ echo 'hi+' | sed  -E 's/(.+)/{\1}/'
{hi+}

This does not:

$ echo 'hi+' | sed --posix -E 's/(.+)/{\1}/'
h{i+}

And escaping the plus sign doesn't give it special meaning, either:

$ echo 'hi+' | sed --posix -E 's/(.\+)/{\1}/'
h{i+}

I don't believe this falls under the [Regex syntax clash](
https://www.gnu.org/software/sed/manual/sed.html#index-Non_002dbugs_002c-regex-syntax-clashes)
non-bug category, as all the [POSIX specs since 2008](
http://pubs.opengroup.org/onlinepubs/9699919799.2008edition/basedefs/V1_chap09.html#tag_09_04_03)
say "The <asterisk>, <plus-sign>, <question-mark>, and <left-brace> shall
be special except when used in a bracket expression."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]