How does the ? make a quantifier lazy in regex
? can mean a lot of different things in different contexts. Following a normal regex token (a character, a shorthand, a character class, a group…), it means “Match the previous item 0-1 times”. Following a quantifier like ?, *, +, {n,m}, it takes on a different meaning: “Make the previous quantifier lazy instead of greedy … Read more