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

Viewed 775
1 Answers

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:

  • "nongreedy {}" with syntax re{...}?
  • additional anchors and character types \A, \C, \d, \D, \G, \p, \P, \s, \S, \X. \Z, \z.
  • (?#comment)
  • shy grouping (?:re), shy grouping + modifiers (?modifiers:re)
  • lookahead and negative lookahead (?=re) and (?!re), lookbehind and negative lookbehind (?<=p) and (?<!p)
  • Atomic groups (?>re)
  • Conditional expression (?(cond)re)
  • ... and more, see man pcresyntax
Related