HomeFreeBSD

bsdgrep: disable GNU_GREP_COMPAT by default

Description

bsdgrep: disable GNU_GREP_COMPAT by default

The GNU extension bits in the base system are old, no longer faithful
to upstream, and surprising in some regards. Switch to documenting
WITH_GNU_GREP_COMPAT and default GNU_GREP_COMPAT to OFF in the name of
good behavior.

According to http://www.regular-expressions.info, GNU extensions:

  • Add missing quantifiers to BREs: \?, \+
  • Add branching to BREs: \|
  • Add backreferences (\1 through \9) to EREs
  • Add \w, \W, \s, and \S corresponding to :alnum:, [^[:alnum:]], :space:, and [^[:space:]] respectively
  • Add word boundaries and anchors: \b: word boundary \B: not word boundary \<: Strt of word \>: End of word \`: Start of subject string \': End of subject string

These extensions are still available in /usr/bin/grep by default today,
as it is still GNU grep. As part of the bsdgrep migration plan these
extensions may be added to bsdgrep's regex support if necessary.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10114