Charles Levert wrote:
Would replacing each newline character in the aggregated pattern by a vertical line character do the trick? Just as the tricks that are used to support -w and -x, this can be abused by a user who intentionally feeds in an invalid pattern or pattern list (e.g., "echo 'x y z' | grep -P -w --color 'x) y (z'").
I imagine that would work iff "|" is the lowest-precedence operator supported by Perl regexps (and means alternation as in EREs). I don't know anything about them.
I don't understand what your example command demonstrates. - Julian