Lazy quantifier {,}? not working as I would expect
问题 I have an issue with lazy quantifiers. Or most likely I misunderstand how I am supposed to use them. Testing on Regex101 My test string is let's say: 123456789D123456789 .{1,5} matches 12345 .{1,5}? matches 1 I am OK with both matches. .{1,5}?D matches 56789D !! I would expect it to match 9D Thanks for clarifying this. 回答1: First and foremost, please do not think of greediness and laziness in regex as means of getting the longest/shortest match . "Greedy" and "lazy" terms only pertain to the