From 3766bf728a43933083f4525970bcf9fdace3838d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Wed, 26 Feb 2020 22:59:22 +0100 Subject: [PATCH] Don't complain about the regexp "[:-:]" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Suggested by Clément Pit-Claudel. * src/regex-emacs.c (regex_compile): * test/src/regex-emacs-tests.el (regexp-invalid): Tolerate ranges. --- src/regex-emacs.c | 2 +- test/src/regex-emacs-tests.el | 3 ++- 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 -- 2.39.2