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 2 years ago, Updated 2 years ago, 54 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.