pbohuch wrote:
>
> testString := 'this is a test'.
> testCollection := '(^\s*)|(\s)|\w+' asRegex matchesIn: testString.
>
If I execute this in a workspace, I get an infinite loop. I think it's a
problem with the expression - don't ^\s* and \w+ look for the same
thing? Anyway, wouldn't '\w+|\s+' do what you want?
'this is a test' allRegexMatches: '\w+|\s+'
"=> ('this' ' ' 'is' ' ' 'a' ' ' 'test')"
Or if you just want the words, '\w+'. And, if you just want the words
then you can probably just use #findTokens:
'this is a test' findTokens: ' '
"=> ('this' 'is' 'a' 'test')"
Regards,
Zulq.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners