From: Zach Dennis Date: 2004-08-18T04:55:28+09:00 Subject: Re: multiple regexp matches According to rdoc you are mistaken. I also think you are mistaken: #!/usr/bin/ruby t = "This is my 1 text" re = /([^\s]*\s).*(\d)(\s.)/ md = re.match( t ); puts md.offset(0); puts "" puts md.offset( 1 ); puts "" puts md.offset( 2 ); puts "" puts md.offset( 3 ); It returns the correct offsets of the matches. offset(0) being the whole regex, offset(1) does the first subexpression, offset(2) does the second subexpression. It works. Zach Kevin Howe wrote: >"Zach Dennis" wrote in message >news:4122539A.1000900@mktec.com... > > >>Instead of using str.scan(re) use: >> >>re.match( str ); >> >>which returns a MatchData object. You can use the MatchData object's >>offset method to find your results.....i do believe. >> >> > >Yes that's true, but if you read the second part of my message, I'd already >tried this: > > > >>The Regexp module will return offsets, but Regexp::match only returns the >>first match, so I'm not sure how to get the full list of matches? >> >> > > > > > > >