regexgrepgnupcre

What are the differences between GNU grep's basic/extended and PCRE (`-P`) regular expressions?


GNU grep's basic (BRE) and extended (ERE) syntax is documented at https://www.gnu.org/software/grep/manual/html_node/Regular-Expressions.html and PCRE is summarized at man pcresyntax, but there is no explicit comparison. What are the differences between GNU grep's basic/extended and PCRE (-P) regular expressions?


Solution

  • My research of the major syntax and functionality differences from http://www.greenend.org.uk/rjk/tech/regexp.html:

    Perl supports much more additional functionality:

    For other engines, see Regular Expression Engine Comparison Chart by CMCDragonkai