summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/regexp-opt.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index b6fac1355c1..894cc4c4be7 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -120,7 +120,9 @@ in REGEXP."
(let ((count 0) start)
(while (string-match "\\(\\`\\|[^\\]\\)\\\\\\(\\\\\\\\\\)*([^?]"
regexp start)
- (setq count (1+ count) start (match-end 0)))
+ (setq count (1+ count)
+ ;; Go back 2 chars (one for [^?] and one for [^\\]).
+ start (- (match-end 0) 2))
count)))
;;; Workhorse functions.