Patrick He
9/28/2008 7:42:00 PM
Or:
irb(main):004:0> a = 'aabbcc<p>ccddee</p>ccc<p>eee</p>'
=> "aabbcc<p>ccddee</p>ccc<p>eee</p>"
irb(main):005:0> a.scan(%r{<p>([^<]*)</p>})
=> [["ccddee"], ["eee"]]
I perfer to specify what character(s) not to match explicitly.
Ittay Dror wrote:
>
> or:
> irb(main):001:0> a = 'aabbcc<p>ccddee</p>'
> => "aabbcc<p>ccddee</p>"
> irb(main):002:0> a[%r{<p>(.*)</p>}, 1]
> => "ccddee"
>