You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using regexes with non-capturing groups together with escaped parenthesis in substitution rules leads to an error.
Expected behaviour: regular expression is considered valid.
Current behaviour: error capture group not supported; use '(?:' instead of '('.
Package example:
extends: substitutionmessage: "Use '%s' instead of '%s'."link: "https://example.com/styleguide/style/wordlist/"level: errorignorecase: falseaction:
name: replaceswap:
'(?:\()(?:api|Api)(?:\))?': API
(I realize that escaped parentheses in this particular regex are redundant — I've actually got more difficult case, but I've prepared this simpler one for the issue demonstration)
Check for existing issues
Environment
3.3.0 in Vale Studio
Describe the bug / provide steps to reproduce it
Using regexes with non-capturing groups together with escaped parenthesis in substitution rules leads to an error.
Expected behaviour: regular expression is considered valid.
Current behaviour: error
capture group not supported; use '(?:' instead of '('
.Package example:
(I realize that escaped parentheses in this particular regex are redundant — I've actually got more difficult case, but I've prepared this simpler one for the issue demonstration)
In Vale Studio: https://studio.vale.sh/s/e49686ef79df096fefe7886dce4fb9e1
In regex101: https://regex101.com/r/6G21Pd/1
Seems that the issue is in these lines: ./internal/check/substitution.go#L69-L70.
I've made an attempt at fixing it: https://github.com/teners/vale/commit/54203033a56581489828ddc92079be7e51da7366, if that's the right way I can submit a PR.
The text was updated successfully, but these errors were encountered: