Do not know where this question should be asked, borrow treasure to ask for a moment.
Just see an example, there are three groups of characters as follows:
Z
Zo
Zoo
Why zo* can match Z? Zo+ can only match Zo,zoo.
is zo* equal to z{1}o*?
Beginners have just started to learn the regular, many places still do not understand, but also the master to give guidance, thank you.
Reply to discussion (solution)
* Indicates a match for the preceding character 0 or more times, + indicates one or more times
Zo* indicates that there are 0 or more o,zo+ behind Z to indicate that there are 0 or more o behind the Zo
Why zo* can match Z? Zo+ can only match Zo,zoo.
* Indicates a match 0 or more times
So zo* match Z back 0 o to n o all can
Z
Zo
Zoo
Zoooo ... All can
If you want to match at least once
Should write zo+
Thank you upstairs for two people.
* and + meaning I understand that I just don't understand the scope of their influence. According to your answer, it appears that * and + will only affect O and have no effect on Z. I have always thought that zo* means there are 0 or n zo, that seems I understand wrong, zo* should be referring to have 1 z,0 or n o, it should be so?
Thank you upstairs for two people.
* and + meaning I understand that I just don't understand the scope of their influence. According to your answer, it appears that * and + will only affect O and have no effect on Z. I have always thought that zo* means there are 0 or n zo, that seems I understand wrong, zo* should be referring to have 1 z,0 or n o, it should be so?
Well, you understand right now.
0 or n zo should be written like this (ZO) *
Why zo* can match Z?
Zo* represents a combination of a z and a 0 to n O of characters
The matching unit of a regular expression is a character, not a word
Thank you all, now it's clear.