A possessive quantifier takes the characters that the next part of the regular expression needs, so it never matches
What it finds
A possessive quantifier takes the characters that the next part of the regular expression needs, so it never matches
<?php$a = preg_match('/".*+"/', $s);tx0 reports: takes the character that follows it$b = preg_match('/\d++5/', $s);tx0 reports: takes the character that follows it$c = preg_match('/"[^"]*+"/', $s);$d = preg_match('/\d++x/', $s);$e = preg_match('/a*+A/i', $s); Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/php:regex-possessive-starves" = "error"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:regex-possessive-starves] reason="..."tx0 explain tx0/php:regex-possessive-starves shows the same in the terminal. Found a false positive? Report it.