Thanks for the pointer. It seems that wrap allows you to conditionally change existing functionality, allowing for fallback to original functionality in the default case. Good if you don't want to edit nice, tested framework code.
In my case, I want to replace tags from the outside in kind of iteratively. So, in pseudo-code: startString = '[q]outside level[q]inner level[/q]back to outer[/q]completely outside quote block'; I'm guessing that iteration and greedy matching is the only way to do it. Am I missing something? Thanks again, Steve Dan Dorman wrote: > > > On Nov 8, 2007 2:16 PM, s.ross <[EMAIL PROTECTED]> wrote: >> Is there a straightforward >> way to match and process the nestings using a function as a second >> argument >> to gsub? > > I'm not sure this will work for what you're doing, but using 1.6's > wrap feature sounds like it could be just the ticket. > > Kangax wrote a great lil' article about it: > > <http://thinkweb2.com/projects/prototype/2007/09/14/wrap-it-up/> > > Hope that helps. > > :Dan Dorman > > > > > -- View this message in context: http://www.nabble.com/Help-W--gsub-on-Nested-Expression-tf4773701.html#a13656395 Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
