2022-06-04 Paul Eggert <eggert@cs.ucla.edu>
+ regex-quote: \} -> } in EREs
+ * lib/regex-quote.c (ere_special): Don’t use \} in EREs,
+ as POSIX says the interpretation is undefined.
+ * tests/test-regex-quote.c (test_bre, test_ere):
+ Add tests for }.
+
dfa: do not warn about \] and \}
* lib/dfa.c (lex): Do not warn about \] and \}, since they’re
surely universally supported even though POSIX says their
static const char bre_special[] = "$^.*[\\";
/* Characters that are special in an ERE. */
-static const char ere_special[] = "$^.*[\\+?{}()|";
+static const char ere_special[] = "$^.*[\\+?{()|";
struct regex_quote_spec
regex_quote_spec_posix (int cflags, bool anchored)
{
check ("aBc", 0, "aBc");
check ("(foo[$HOME])", 0, "(foo\\[\\$HOME])");
+ check ("(foo{$HOME})", 0, "(foo{\\$HOME})");
}
static void
{
check ("aBc", REG_EXTENDED, "aBc");
check ("(foo[$HOME])", REG_EXTENDED, "\\(foo\\[\\$HOME]\\)");
+ check ("(foo{$HOME})", REG_EXTENDED, "\\(foo\\{\\$HOME}\\)");
}
int