Friday 2 August 2019

Practical use of possessive quantifiers regex

I understand .* (greedy quantifier) backtracks and tries to find a match. and .*+ (possessive quantifier) does not backtrack.



However I have been using .* and .\*? frequently but don't know when to use .*+.



Can somebody give a situation or an example where .*+ should be used?



explanation with an example is appreciated.



EDIT:




i have gone through the theory part and i repeat i understand how it works. i just need one example that matches possessive quantifiers (.*+)

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...