rspec/rules/S5994/description.adoc

8 lines
479 B
Plaintext

Possessive quantifiers in Regex patterns like below improve performance by eliminating needless backtracking:
----
?+ , *+ , ++ , {n}+ , {n,}+ , {n,m}+
----
But because possessive quantifiers do not keep backtracking positions and never give back, the following sub-patterns should not match only similar characters. Otherwise, possessive quantifiers consume all characters that could have matched the following sub-patterns and nothing remains for the following sub-patterns.