From: tietyt@... Date: 2005-06-23T16:15:37+09:00 Subject: Re: Getting a list of results from one regular expression First of all, thanks for all that super fast help. I've never asked a technical question anywhere before and got such a fast response. Specifically to Pit Capitain: Thanks for that tip. I just googled that and learned what the .*? does. Pit Capitain wrote: > tietyt@gmail.com schrieb: > > Here's my situation, I've got this long string that contains XML. I > > would like to parse it. Specifically, I want to search this string for > > all instances of a pattern like /stringAlias="(.*)"/ > > One additional remark: if the input can contain multiple stringAlias > expressions on one line, the pattern should be /stringAlias="(.*?)"/ > (note the question mark). You can see the difference if you match a > string like > > str = "stringAlias=\"one\" bla stringAlias=\"two\"" > > p str.scan( /stringAlias="(.*)"/ ) > # => [["one\" bla stringAlias=\"two"]] > > p str.scan( /stringAlias="(.*?)"/ ) > # => [["one"], ["two"]] > > Regards, > Pit