R
rpardee
Hey All,
I need to parse lines that look like this:
<lines>
1 'Not qualified' 2 'Overquota' 3 'Qualified'/
1 'SSI' 2 'Mall Facility'/
1 'Real Interview' 2 'Practice Interview'/
</lines>
So I've got N sets of <<digits>><<space>><<quote-delimited-label>> on
each line. I want to grab each of the digits & labels, but I'm having
trouble w/the repetition stuff. Below is a simple script that doesn't
work--it grabs the first set, but seems to ignore the rest.
str = "1 'Not qualified' 2 'Overquota' 3 'Qualified'"
rgx = /((\d+)\s+(\'[^']+?\'))+/i
m = rgx.match(str)
unless m.nil?
m.captures.each {|c| puts(c)}
end
Can anybody throw me a regex clue here?
Thanks!
- Roy
I need to parse lines that look like this:
<lines>
1 'Not qualified' 2 'Overquota' 3 'Qualified'/
1 'SSI' 2 'Mall Facility'/
1 'Real Interview' 2 'Practice Interview'/
</lines>
So I've got N sets of <<digits>><<space>><<quote-delimited-label>> on
each line. I want to grab each of the digits & labels, but I'm having
trouble w/the repetition stuff. Below is a simple script that doesn't
work--it grabs the first set, but seems to ignore the rest.
str = "1 'Not qualified' 2 'Overquota' 3 'Qualified'"
rgx = /((\d+)\s+(\'[^']+?\'))+/i
m = rgx.match(str)
unless m.nil?
m.captures.each {|c| puts(c)}
end
Can anybody throw me a regex clue here?
Thanks!
- Roy