Prefer character classes instead of groups if possible
RunDevelopment opened this issue · 0 comments
RunDevelopment commented
Example:
/(?:a|b|c)/ => /[abc]/
/(?:\w|-|\+|\*|\/)+/ => /[\w+*/-]+/
/(a|b|c)/ => /([abc])/
/(?:[ab]|c)/ => /[abc]/
/(?:a|b)/ // stay like thisNote:
This rules should only affect groups with a) >= 3 alternatives or b) at least one character class.