'previous-system-time-locale' have been removed, as they were created
by mistake and were not useful to Lisp code.
+** The regexp mistake '[:digit:]' is now an error.
+The correct syntax is '[[:digit:]]'. Previously, forgetting the extra
+brackets silently resulted in a regexp that did not at all work as
+intended.
+
\f
* Lisp Changes in Emacs 28.1
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
REG_ERPAREN, /* Unmatched ) or \); not returned from regcomp. */
REG_ERANGEX, /* Range striding over charsets. */
- REG_ESIZEBR /* n or m too big in \{n,m\} */
+ REG_ESIZEBR, /* n or m too big in \{n,m\} */
+ REG_ECLASSBR, /* Missing [] around [:class:]. */
} reg_errcode_t;
static const char *re_error_msgid[] =
[REG_ERPAREN] = "Unmatched ) or \\)",
[REG_ERANGEX ] = "Range striding over charsets",
[REG_ESIZEBR ] = "Invalid content of \\{\\}",
+ [REG_ECLASSBR] = "Class syntax is [[:digit:]]; missing brackets",
};
/* For 'regs_allocated'. */
laststart = b;
+ /* Check for the mistake of forgetting the extra square brackets,
+ as in "[:alpha:]". */
+ if (*p == ':')
+ {
+ re_char *q = p + 1;
+ while (q != pend && *q != ']')
+ {
+ if (*q == ':')
+ {
+ if (q + 1 != pend && q[1] == ']' && q > p + 1)
+ FREE_STACK_RETURN (REG_ECLASSBR);
+ break;
+ }
+ q++;
+ }
+ }
+
/* Test '*p == '^' twice, instead of using an if
statement, so we need only one BUF_PUSH. */
BUF_PUSH (*p == '^' ? charset_not : charset);
(should-not (string-match "å" "\xe5"))
(should-not (string-match "[å]" "\xe5")))
+(ert-deftest regexp-invalid ()
+ ;; relint suppression: Duplicated
+ (should-error (string-match "[:space:]" "")
+ :type 'invalid-regexp))
+
;;; regex-emacs-tests.el ends here