Thread: Regex examples
View Single Post
Old 03-19-2025, 06:54 PM   #780
Haudek
Member
Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.Haudek knows the difference between a duck.
 
Posts: 24
Karma: 111614
Join Date: Mar 2025
Location: Poland
Device: Kindle Voyage
Quote:
Originally Posted by Pavulon View Post
Would you have an explanation, not too learned for me, as to why the formula (.*?)? only works when the chain is present, whereas the quantifier says (0 or 1)?
The expression (.*?)? is actually quite specific and I don't think I've ever used it. It works by matching an optional (0 or 1) group, which in turn tries to match as few characters as possible.

Look here. That "empty string" in the first line does not literally mean that something is "present."
Haudek is offline   Reply With Quote