Regex Problem Needing assistance

F:\DIRT\RTP-Scripting>irb --version
irb 0.9.6(09/06/30)

Code:
m1 = "<font size=2>Your search has 88 resulted 333 in 253 projects
stored on 6 pages.<br>These $222,042,095 projects represent $63,795,755
in RTP Funding, and $3,042,095 in other funding.</font>$32,042,095 kkkk
$303,042,095"
regex2 = Regexp.new(/([0-9]+,[0-9]+,[0-9]+\b|[0-9]+)/)
xx= regex2.match(m1)
puts xx.inspect

output:
#<MatchData "2" 1:"2">

My assumption it would return the following:
Result 1

    2

Result 2

    88

Result 3

    333

Result 4

    253

Result 5

    6

Result 6

    222,042,095

Result 7

    63,795,755

Result 8

    3,042,095

Result 9

    32,042,095

Result 10

    303,042,095

what am I doing wrong?

···

--
Posted via http://www.ruby-forum.com/.

Regexp#match returns the first match only.
If you want all matches, use the String#scan method.

m1.scan /[0-9]+,[0-9]+,[0-9]+\b|[0-9]+/
#=> ["2", "88", "333", "253", "6", "222,042,095", "63,795,755",
"3,042,095", "32,042,095", "303,042,095" ]

Thank you...That rocks

···

--
Posted via http://www.ruby-forum.com/.