[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp linting scan
From: |
Mattias Engdegård |
Subject: |
Re: Regexp linting scan |
Date: |
Thu, 5 Dec 2019 13:11:58 +0100 |
5 dec. 2019 kl. 12.38 skrev Mattias Engdegård <address@hidden>:
>
> 5 dec. 2019 kl. 03.10 skrev Michael Welsh Duggan <address@hidden>:
>
>>> - (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)
>>
>> Similarly, in this one I think you could also replace the `+' with a `*'
>> and leave out the `?'.
>
> Group 1 is used in a backref, which only matches if the group matched. With
> your change, the regexp would match ".()", which isn't matched at present.
Correction: the '?' can be removed (keeping the '+') since the \1 is matched
unconditionally.