The man pages for grep on Ubuntu 18.04 and CentOS 8 have this to say about the -P option for grep:
-P, --perl-regexp Interpret the pattern as a Perl-compatible regular expression (PCRE). This is experimental and grep -P may warn of unimplemented features.
I have put emphasis on "experimental" and "may warn". Experimental implies it's not suitable for production. "may warn" implies that you could run into an unimplemented feature and grep could fail to warn you about it.
On older versions of grep, I have even seen the phrase "highly experimental" instead of just "experimental".
Is the -P option to GNU grep safe to use in production? Some of my bootstrapping scripts need certain perl features, so this option is quite useful to me when perl has not already been installed/included.
grep -Pis of course absolutely non-portable; but if it works on your system, why not just use it?grep -Pis based on thepcrelibrary, which is already used all over the place. IMLE it'sgrep -Ewhich may get pathologically slow on some innocent regexes + inputs whichgrep -Pwill breeze through (but, unfortunately I don't have any examples at hand).foldhacks to work with grapheme clusters (I was actually shocked that it's implementation offoldeven supported grapheme clusters). I just like to know I have options available out of the box before I have started installing packages.