From: Ben Bleything Date: 2008-10-04T00:44:33+09:00 Subject: Re: Explain this ruby regex On Sat, Oct 04, 2008, renton.dan@gmail.com wrote: > "one two".scan(/\w*/).length > > returns 4. I can see it matching the 2 words and the space, what else > is it matching on? Is there a null terminator, I thought Ruby strings > were not null termed. Try replacing #length with #inspect and seeing what the output of scan is. You'll find that it's returning two empty strings as well. I suspect what you really want is \w+... Ben