On Mon, Apr 20, 2009 at 10:38 AM, John Smith <rails-mailing-l...@andreas-s.net> wrote: > > Thanks again for yyour help. > Anyway, can you explain the meaning of (?=[^<]). I know that [^<] means > no math '<', but why should I use the '()' and '?=' ?
(?=<pattern>) is a look-ahead match that doesn't consume the characters matched In string "cartoon" /car(?=[^<])/ will only match "car" and /car[^<]/ will match "cart" /car(?=[^<])/ can actually be rewritten as /car(?!<)/ where ?! is a negative look ahead (?<<pattern>) is a look-behind match that doesn't consume the characters matched (only Ruby 1.9) Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---