Closed aabacchus closed 3 years ago
Thanks
@dylanaraps Is alternation part of POSIX BREs? As far as I can tell, the sequence \|
isn't defined for POSIX BREs, but \
is specified for EREs.
Despite this, all the implementations I've tested - GNU, Busybox, sbase - accept it, except for 9base, which uses EREs of the type "before egrep got complicated". I think the widest compatibility is to use extended mode?
From the most recent draft of POSIX 1003.1 202x, Rationale for Base Definitions:
Some implementations have extended the BRE syntax to add alternation. For example, the subexpression "
\(foo$\|bar\)
" would match either "foo
" at the end of the string or "bar
" anywhere. The extension is triggered by the use of the undefined "\|
" sequence.
Fixed, thanks.
The ERE matches the package name, followed by either a space character or an end-of-line. This prevents matching packages whose names contain the target name. A word boundary '\>' is not used, because this matches a hyphen '-' and not end-of-lines. The end-of-line anchor '$' cannot be used in a bracket expression.