I looked in ruby documentation http://www.ruby-doc.org/core-1.9.3/Regexp.html I cannot find a method called pre_match but its used in Rails... @template.instance_variable_get("@#{Regexp.last_match.pre_match}") -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
http://www.ruby-doc.org/core-1.9.3/MatchData.html#method-i-pre_match On Thursday, September 6, 2012 1:40:31 AM UTC-4, John Merlino wrote:> > I looked in ruby documentation > > http://www.ruby-doc.org/core-1.9.3/Regexp.html > > I cannot find a method called pre_match but its used in Rails... > > @template.instance_variable_get("@#{Regexp.last_match.pre_match}") >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/NiP2THLS7y0J. For more options, visit https://groups.google.com/groups/opt_out.
yep, last_match returns a MatchData object, which contains some wrapper methods, including a string of the last successful pattern match. Hence, pre_match would fall under MatchData, not Regexp. On Sep 6, 10:21 am, Rick <richard.t.ll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> http://www.ruby-doc.org/core-1.9.3/MatchData.html#method-i-pre_match > > > > > > > > On Thursday, September 6, 2012 1:40:31 AM UTC-4, John Merlino wrote: > > > I looked in ruby documentation > > >http://www.ruby-doc.org/core-1.9.3/Regexp.html > > > I cannot find a method called pre_match but its used in Rails... > > > @template.instance_variable_get("@#{Regexp.last_match.pre_match}")-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.