mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Use [^z-a] for matching any character (anychar/anything) in rx
* lisp/emacs-lisp/rx.el (rx--translate-symbol): * test/lisp/emacs-lisp/rx-tests.el (rx-any, rx-atoms): Use [^z-a] instead of ".\\|\n" for anychar. The new expression is faster (about 2×) and does not allocate regexp stack space. For example, (0+ anychar) now matches strings of any size (bug#37659).
This commit is contained in:
parent
ae5407b857
commit
6331d23de3
2 changed files with 4 additions and 4 deletions
|
|
@ -136,7 +136,7 @@ Each entry is:
|
|||
;; Use `list' instead of a quoted list to wrap the strings here,
|
||||
;; since the return value may be mutated.
|
||||
((or 'nonl 'not-newline 'any) (cons (list ".") t))
|
||||
((or 'anychar 'anything) (rx--translate-form '(or nonl "\n")))
|
||||
((or 'anychar 'anything) (cons (list "[^z-a]") t))
|
||||
('unmatchable (rx--empty))
|
||||
((or 'bol 'line-start) (cons (list "^") 'lseq))
|
||||
((or 'eol 'line-end) (cons (list "$") 'rseq))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue