mirror of
https://github.com/uutils/grep.git
synced 2026-06-10 16:15:11 -07:00
grep: honor GNU buffer anchors (#56)
This commit is contained in:
@@ -269,6 +269,10 @@ impl CompiledPattern {
|
||||
// GNU grep supports `{,n}` as an alias for `{0,n}`.
|
||||
syntax.enable_behavior(SyntaxBehavior::SYNTAX_BEHAVIOR_ALLOW_INTERVAL_LOW_ABBREV);
|
||||
}
|
||||
if matches!(config.regex_mode, RegexMode::Basic | RegexMode::Extended) {
|
||||
// GNU grep supports \` and \' as buffer anchors in BRE and ERE.
|
||||
syntax.enable_operators(SyntaxOperator::SYNTAX_OPERATOR_ESC_GNU_BUF_ANCHOR);
|
||||
}
|
||||
if config.regex_mode == RegexMode::Perl {
|
||||
// GNU grep supports `(?P<name>...)`.
|
||||
// Unfortunately, the onig crate defines the OP2 flag without the
|
||||
|
||||
Reference in New Issue
Block a user