From: danfinnie@... Date: 2006-12-06T03:58:08+09:00 Subject: Re: doubt with positive lookaround --Boundary_(ID_6teLwAHnEOiufpv/Axk+Ug) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline There are a few types of "lookarounds": positive lookahead, negative lookahead, positve lookbehind, negative look behind. To use positive lookbehind, you would use (?<=...). Ruby might be interpreting ?=< as ?<=. Try escaping the < by adding a \ before it. ----- Original Message ----- From: hemant Date: Monday, December 4, 2006 11:29 pm Subject: doubt with positive lookaround To: ruby-talk@ruby-lang.org (ruby-talk ML) > I do not understand behavior of positive look arounds in Ruby: > > chunked_data = "DIVex>##ECHO=b698fd4cc1ea4c7a4b5c4e1d1c402911##" > p $& if chunked_data =~ /(?=DIVex)DI/ # => DI > > However, > > chunked_data = "##ECHO=b698fd4cc1ea4c7a4b5c4e1d1c402911##" > p $& if chunked_data =~ /(?= nil > > > does < gets treated as special character inside (?= ..) ? > > > > > > > -- > There was only one Road; that it was like a great river: its springs > were at every doorstep, and every path was its tributary. > > --Boundary_(ID_6teLwAHnEOiufpv/Axk+Ug)--