Open cbachhuber opened 2 hours ago
Since there are only 4 options in ruby regex, I suggest extending the matcher in this line to something like
!%r{^/.*/([imxo]){0,4}$}.match(string).nil?
and correspondingly passing on the provided options to the regex object.
To enable regex, the config requires the search string to start and end with
/
. However, ruby regexes pass options after the end delimiter, so that's conflicting. I can reproduce this with the following.pre-commit-search-and-replace.yaml
:matches a file such as
while
doesn't match, since this is not seen as regex per this line.
How should we best implement this? Provide another command line argument, similar to
--insensitive
? I tried that, but it doesn't seem to work assearch_opts: "--insensitive"
in.pre-commit-search-and-replace.yaml
orargs: ["--insensitive"]
in.pre-commit-config.yaml
.