[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp linting scan
From: |
Michael Welsh Duggan |
Subject: |
Re: Regexp linting scan |
Date: |
Wed, 04 Dec 2019 21:10:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Paul Eggert <address@hidden> writes:
> Thanks for the scan; I installed the attached.
>
> diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el
> index 05f27e4d99..b658ffab58 100644
> --- a/lisp/mail/rfc2368.el
> +++ b/lisp/mail/rfc2368.el
> @@ -61,7 +61,7 @@
> ;; only an approximation?
> ;; see rfc 1738
> (defconst rfc2368-mailto-regexp
> - "^\\(mailto:\\)\\([^?]+\\)*\\(\\?\\(.*\\)\\)*"
> + "^\\(mailto:\\)\\([^?]+\\)?\\(\\?\\(.*\\)\\)*"
> "Regular expression to match and aid in parsing a mailto url.")
>
> ;; describes 'mailto:'
Wouldn't "^\\(mailto:\\)\\([^?]*\\)\\(\\?\\(.*\\)\\)*" make more sense?
Maybe even without the grouping, as it doesn't seem to be used. If I'm
not mistaken (and I might be) this matches "mailto:" followed by anything
as long as it contains at most one question mark.
> diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
> index 0afbdc3dd1..6ec8d995c1 100644
> --- a/lisp/progmodes/verilog-mode.el
> +++ b/lisp/progmodes/verilog-mode.el
> @@ -10973,7 +10973,7 @@ verilog-inject-inst
> (t
> ;; Delete identical interconnect
> (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))
> (setq end-pt (- end-pt (- (match-end 0)
> (match-beginning 0)))) ; Keep it correct
> (while (or (looking-at "[ \t\n\f,]+")
Similarly, in this one I think you could also replace the `+' with a `*'
and leave out the `?'.
--
Michael Welsh Duggan
(address@hidden)