From: Nathan on 9 Apr 2010 04:40 > "tttttattttt".match(/ttt(?=a)/) # http://rubular.com/r/21Zo6JP09f => ["ttt"] > "tttttattttt".match(/(?=a)ttt/) # http://rubular.com/r/d1VSUwwZUu => nil Why? And how can I get this effect?
From: Robert Klemme on 9 Apr 2010 06:08 On 04/09/2010 10:40 AM, Nathan wrote: >> "tttttattttt".match(/ttt(?=a)/) # http://rubular.com/r/21Zo6JP09f > => ["ttt"] >> "tttttattttt".match(/(?=a)ttt/) # http://rubular.com/r/d1VSUwwZUu > => nil > > Why? And how can I get this effect? It seems you have just demonstrated how to get the effect you described. For more info: http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt Note: you need Ruby 1.9. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/
From: Nathan on 9 Apr 2010 08:13 Ah (?<=a)ttt is what I was after. Thanks for the link. On Apr 9, 11:10 am, Robert Klemme <shortcut...(a)googlemail.com> wrote: > On 04/09/2010 10:40 AM, Nathan wrote: > > >> "tttttattttt".match(/ttt(?=a)/) #http://rubular.com/r/21Zo6JP09f > > => ["ttt"] > >> "tttttattttt".match(/(?=a)ttt/) #http://rubular.com/r/d1VSUwwZUu > > => nil > > > Why? And how can I get this effect? > > It seems you have just demonstrated how to get the effect you described. > > For more info: > > http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt > > Note: you need Ruby 1.9. > > Kind regards > > robert > > -- > remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/
|
Pages: 1 Prev: Closing and reloading compiled extensions Next: How to capture output of linux command |