Git-Hooks icon indicating copy to clipboard operation
Git-Hooks copied to clipboard

Support Extended Regular Expressions in Config Vars

Open mikkoi opened this issue 4 years ago • 3 comments

How could we support extended regular expressions in configuration instead of the more limited standard Perl regex? Add "/x" to the end of the config var string?

This would be useful because extended regex is often more readable.

mikkoi avatar Sep 13 '20 22:09 mikkoi

You mean the POSIX Extended Regular Expressions are more powerful than Perl's? I don't think so.

Please, can you show me some examples to make it clearer?

gnustavo avatar Sep 13 '20 23:09 gnustavo

It's not POSIX I'm after but more whitespace with the /x and /xx Perl modifiers. This is especially important with Git config limitations, all those double backslases, "\\".

https://perldoc.perl.org/perlre.html#Details-on-some-modifiers

mikkoi avatar Sep 14 '20 08:09 mikkoi

Ah, now I get it.

This is a good idea. The way Git::Hooks treat options that may have regexes as values it totally ad-hoc. I think there should be a method in Git::Repository::Plugin::GitHooks responsible for grokking such values so that every plugin could use it. This way we would be able to have more consistency and also to make improvements in a single spot.

I'll have to take some time to think about it.

gnustavo avatar Sep 14 '20 11:09 gnustavo