Konstantin Konstantin - 6 months ago 25
Ruby Question

When trying to escape apostrophe with 'gsub', I get backreference

I have this code:


Instead of
, I get:
. Why?

Answer Source

It is because "\\'" means the context following the match, which is "2".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download