Commit ab612302 authored by Paul Eggert's avatar Paul Eggert

Fix regex repetition of repetitions

Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-12/msg00066.html
* lisp/gnus/gnus-util.el (gnus-emacs-version):
* lisp/mail/rfc2368.el (rfc2368-mailto-regexp):
* lisp/net/tramp-sh.el (tramp-sh-inotifywait-process-filter):
* lisp/obsolete/terminal.el (te-parse-program-and-args):
* lisp/org/org-table.el (org-table-wrap-region):
* lisp/progmodes/verilog-mode.el (verilog-inject-inst):
Avoid repetition-of-repetition in regexp.
parent 4472b053
...@@ -1574,7 +1574,7 @@ sequence, this is like `mapcar'. With several, it is like the Common Lisp ...@@ -1574,7 +1574,7 @@ sequence, this is like `mapcar'. With several, it is like the Common Lisp
(cond (cond
((not (memq 'emacs lst)) ((not (memq 'emacs lst))
nil) nil)
((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version) ((string-match "^[.0-9]*\\.[0-9]+$" emacs-version)
(concat "Emacs/" emacs-version (concat "Emacs/" emacs-version
(if system-v (if system-v
(concat " (" system-v ")") (concat " (" system-v ")")
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
;; only an approximation? ;; only an approximation?
;; see rfc 1738 ;; see rfc 1738
(defconst rfc2368-mailto-regexp (defconst rfc2368-mailto-regexp
"^\\(mailto:\\)\\([^?]+\\)*\\(\\?\\(.*\\)\\)*" "^\\(mailto:\\)\\([^?]+\\)?\\(\\?\\(.*\\)\\)*"
"Regular expression to match and aid in parsing a mailto url.") "Regular expression to match and aid in parsing a mailto url.")
;; describes 'mailto:' ;; describes 'mailto:'
......
...@@ -3799,7 +3799,7 @@ Fall back to normal file name handler if no Tramp handler exists." ...@@ -3799,7 +3799,7 @@ Fall back to normal file name handler if no Tramp handler exists."
(unless (string-match (unless (string-match
(eval-when-compile (eval-when-compile
(concat "^[^[:blank:]]+" (concat "^[^[:blank:]]+"
"[[:blank:]]+\\([^[:blank:]]+\\)+" "[[:blank:]]+\\([^[:blank:]]+\\)"
"\\([[:blank:]]+\\([^\n\r]+\\)\\)?")) "\\([[:blank:]]+\\([^\n\r]+\\)\\)?"))
line) line)
(tramp-error proc 'file-notify-error "%s" line)) (tramp-error proc 'file-notify-error "%s" line))
......
...@@ -1166,7 +1166,7 @@ subprocess started." ...@@ -1166,7 +1166,7 @@ subprocess started."
(let ((l ()) (p 0)) (let ((l ()) (p 0))
(while p (while p
(setq l (cons (if (string-match (setq l (cons (if (string-match
"\\([-a-zA-Z0-9+=_.@/:]+\\)\\([ \t]+\\)*" "\\([-a-zA-Z0-9+=_.@/:]+\\)[ \t]*"
s p) s p)
(prog1 (substring s p (match-end 1)) (prog1 (substring s p (match-end 1))
(setq p (match-end 0)) (setq p (match-end 0))
......
...@@ -4642,7 +4642,7 @@ blank, and the content is appended to the field above." ...@@ -4642,7 +4642,7 @@ blank, and the content is appended to the field above."
(skip-chars-backward " ") (skip-chars-backward " ")
(insert " " (org-trim s)) (insert " " (org-trim s))
(org-table-align))) (org-table-align)))
((looking-at "\\([^|]+\\)+|") ; Split field. ((looking-at "\\([^|]+\\)|") ; Split field.
(let ((s (match-string 1))) (let ((s (match-string 1)))
(replace-match " |") (replace-match " |")
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
......
...@@ -10973,7 +10973,7 @@ shown) will make this into: ...@@ -10973,7 +10973,7 @@ shown) will make this into:
(t (t
;; Delete identical interconnect ;; Delete identical interconnect
(let ((case-fold-search nil)) ; So we don't convert upper-to-lower, etc (let ((case-fold-search nil)) ; So we don't convert upper-to-lower, etc
(while (verilog-re-search-forward-quick "\\.\\s *\\([a-zA-Z0-9`_$]+\\)*\\s *(\\s *\\1\\s *)\\s *" end-pt t) (while (verilog-re-search-forward-quick "\\.\\s *\\([a-zA-Z0-9`_$]+\\)?\\s *(\\s *\\1\\s *)\\s *" end-pt t)
(delete-region (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0))
(setq end-pt (- end-pt (- (match-end 0) (match-beginning 0)))) ; Keep it correct (setq end-pt (- end-pt (- (match-end 0) (match-beginning 0)))) ; Keep it correct
(while (or (looking-at "[ \t\n\f,]+") (while (or (looking-at "[ \t\n\f,]+")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment