What flavour of regular expression is grep?

前端 未结 6 1282
花落未央
花落未央 2021-02-03 23:41

I\'m guessing it\'s not a Perl Compatible Regular Expression, since there\'s a special kind of grep which is specifically PCRE. What\'s grep most simil

6条回答
  •  日久生厌
    2021-02-04 00:19

    Default GNU grep behavior is to use a slightly flavorful variant on POSIX basic regular expressions, with a similarly tweaked species of POSIX extended regular expressions for egrep (usually an alias for grep -E). POSIX ERE is what PHP ereg() uses.

    GNU grep also claims to support grep -P for PCRE, by the way. So no terribly special kind of grep required.

提交回复
热议问题