GNU bug report logs -
#26409
plus (`+`) not a metacharacter with --posix option, escaped or not
Previous Next
Reported by: Jordan Torbiak <torbiak <at> gmail.com>
Date: Sun, 9 Apr 2017 00:56:01 UTC
Severity: normal
Tags: fixed
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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."
[Message part 2 (text/html, inline)]
This bug report was last modified 8 years and 92 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.