My test under Linux (Ubuntu) is shown in the figure below. I wanted to matchAnd < EM >, it turns out that they can’t match lazily
My test results under the regular matching online tool are as follows
POSIX regular does not support laziness. If your grep supports PCRE (- P option), use it.
The syntax, feature support and implementation of different regular engines are different, and the compatibility is not good. To test regularity, you need to use the tools you actually want to use.
egrepAll belong to
Extended regularization, the ability is a little bit unsatisfactory, you can try
echo "this is <EM>first<\EM>" | grep -oP '<.*?>'
Never said PCRE is Perl regular, maybe you’re right
-PDifferent understanding of
Interpret PATTERN as a Perl regular expression. This is highly experimental and grep -P may warn of unimplemented features.