Lazy quantifier {,}? not working as I would expect

Viewed 3049

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.

3 Answers
Related