From: Xiong Chiamiov Date: 2008-09-11T00:53:15+09:00 Subject: Re: problems with oniguruma lookahead Robert Klemme wrote: > With 1.9: > > irb(main):001:0> s="

'Algebra'
" > => "

'Algebra'
" > irb(main):002:0> s.scan %r{(?<=

').*(?='
)} > => [] > irb(main):003:0> s.scan %r{(?<=

').*?(?='
)} > => ["Algebra"] > > Note the non greedy match. I usually rather do this in those cases: > > irb(main):005:0> s.scan %r{

'(.*?)'
} > => [["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/.