In the regular expression, it is aaabbcdfsaabbbdfcsdaaddf that matches (a{1,3}b{1,5}) with (a{1,3}b{1,5}), so why is (a{1,3}b{1,5})* the first aaabb?

Asked 1 years ago, Updated 1 years ago, 44 views

In the regular expression, it is aaabbcdfsaabbbdfcsdaaddf that matches (a{1,3}b{1,5}) with (a{1,3}b{1,5}), so why is (a{1,3}b{1,5})* the first aaabb?

regex

2022-09-21 22:57

1 Answers

This is because * is a quantifier that represents "zero or more".

If you use +, a quantifier that represents "more than one," aaabb and aabbb will match.

ex) (a{1,3}b{1,5})+


2022-09-21 22:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.