summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regex-emacs.c2
-rw-r--r--test/src/regex-emacs-tests.el3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 38824370e05..794958eb461 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -2007,7 +2007,7 @@ regex_compile (re_char *pattern, ptrdiff_t size,
if (*p == ':')
{
re_char *q = p + 1;
- while (q != pend && *q != ']')
+ while (q != pend && *q != ']' && *q != '-')
{
if (*q == ':')
{
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index 661d416e6a7..f1c703ab8bd 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -806,6 +806,7 @@ This evaluates the TESTS test cases from glibc."
(ert-deftest regexp-invalid ()
;; relint suppression: Duplicated
(should-error (string-match "[:space:]" "")
- :type 'invalid-regexp))
+ :type 'invalid-regexp)
+ (should (equal (string-match "[:-:]" "a-:") 2)))
;;; regex-emacs-tests.el ends here