rspec/rules/S5857/description.adoc
2021-09-17 17:52:17 +02:00

2 lines
601 B
Plaintext

Using reluctant quantifiers (also known as lazy or non-greedy quantifiers) in patterns can often lead to needless backtracking, making the regex needlessly inefficient and potentially vulnerable to https://www.regular-expressions.info/catastrophic.html[catastrophic backtracking]. Particularly when using ``++.*?++`` or ``++.+?++`` to match anything up to some terminating character, it is usually a better idea to instead use a greedily or possessively quantified negated character class containing the terminating character. For example ``++<.+?>++`` should be replaced with ``<[^>]{plus}{plus}>``.