summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
-rw-r--r--lisp/emacs-lisp/regexp-opt.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index de9966c0af0..b2d4f2b71dd 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -1,9 +1,9 @@
;;; regexp-opt.el --- generate efficient regexps to match strings
-;; Copyright (C) 1994-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2014 Free Software Foundation, Inc.
;; Author: Simon Marshall <simon@gnu.org>
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: strings, regexps, extensions
;; This file is part of GNU Emacs.
@@ -285,7 +285,9 @@ CHARS should be a list of characters."
;;
;; Make sure a caret is not first and a dash is first or last.
(if (and (string-equal charset "") (string-equal bracket ""))
- (concat "[" dash caret "]")
+ (if (string-equal dash "")
+ "\\^" ; [^] is not a valid regexp
+ (concat "[" dash caret "]"))
(concat "[" bracket charset caret dash "]"))))
(provide 'regexp-opt)