Ok, so I would like to do something like this:
string.gsub(regexp, output(’\0’ ,’\1’, ‘\2’)
Output returns a string.
I tested it in irb and it worked ok. Now when it’s in my application,
the ‘\1’ and others don’t resolve as backreferences to the matches as
they should. How can I fix this? Or go around it?
RoR newbie wrote:
Ok, so I would like to do something like this:
string.gsub(regexp, output(’\0’ ,’\1’, ‘\2’)
Output returns a string.
I tested it in irb and it worked ok. Now when it’s in my application,
the ‘\1’ and others don’t resolve as backreferences to the matches as
they should. How can I fix this? Or go around it?
Oh, made a typo, it shoud’ve been:
string.gsub(regexp, output(’\0’ ,’\1’, ‘\2’))
gsub takes a block so you can do something like this:
string.gsub(regexp) {|x, y, z| output(x, y, z) }
Not sure why your previous expression didn’t work between rails and irb
though… Are you using different ruby versions between the two
environments?
On Oct 21, 5:40 am, RoR newbie [email protected]