Robert Klemme wrote:
> With 1.9:
> 
> irb(main):001:0> s="<p><b>'Algebra'</b><br>"
> => "<p><b>'Algebra'</b><br>"
> irb(main):002:0> s.scan %r{(?<=<p><b>').*(?='</b><br>)}
> => []
> irb(main):003:0> s.scan %r{(?<=<p><b>').*?(?='</b><br>)}
> => ["Algebra"]
> 
> Note the non greedy match.  I usually rather do this in those cases:
> 
> irb(main):005:0> s.scan %r{<p><b>'(.*?)'</b><br>}
> => [["Algebra"]]
> 
> I.e. use groups to extract the part that I am interested in.
> 
> Kind regards
> 
> robert

Ah, thank you very much.  My regex learning was with PHP (PCRE, not 
POSIX), which has some odd rules, especially regarding 
greedy/non-greedy, so I'm still trying to recover from that.

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