260915.2 · 1739556b7485df48bde0c256ae9c76096b3f537b
update matching mode flags logic
- make mode flags -E, -F, -G, -P respect order on the command line to permit overriding (like BSD grep)
- warn when used in a config file #562
reading declarations
Changes to src/cnf.hpp. All files
@@ -178,14 +178,14 @@ class CNF { { // -x: make the regex line-anchored // -G requires \( \) instead of ( )- const char *xleft = flag_basic_regexp ? "^\\(" : "^(?:";- const char *xright = flag_basic_regexp ? "\\)$" : ")$";+ const char *xleft = flag_mode == Mode::BRE ? "^\\(" : "^(?:";+ const char *xright = flag_mode == Mode::BRE ? "\\)$" : ")$"; pattern.insert(0, xleft).append(xright); } else if (flag_word_regexp) { // -w: make the regex word-anchored (or implicitly done with matcher option W instead of \< and \>)- if (flag_perl_regexp)+ if (flag_mode == Mode::PERL) { // -P requires (?<!\w) (?!\w) instead of \< and \> #if defined(HAVE_PCRE2)