質問

What is the difference between (a|b)* and a*b*? Can you show more examples of Kleene star and patterns? I've searched so many sites in Google, but it returns very little results on this topic. I would be very grateful as I am trying to understand how PHP regular expressions work.

役に立ちましたか?

解決

(a|b)* means "a or b, any number of times". a*b* means "Any number of a's then followed by any number of b's". So there exist strings ("baa", "abba", etc) that match the first, but not the second.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top