From: Robert Klemme Date: 2008-10-06T01:18:22+09:00 Subject: Re: Explain this ruby regex On 03.10.2008 18:44, Patrick Doyle wrote: > The key idea here is that "*" means "match zero or more of" whereas "+" > means "match one or more of". So, when you match \w* against "one two", > there are zero or more instances of a word character (3, in fact, 'o', 'n', > and 'e'), so that produces one result. Following that result, there are > zero matches of a word character, but since you asked for "zero or more of", > you get that empty string result. Later, rinse, repeat for the "two" part. It boils down to this statement: a subexpression with "*" potentially matches an _empty string anywhere_ in a string. Kind regards robert