P
petermichaux
Hi
I'm trying to remove unecessary white space around equals signs and
after semicolons
compressed = "foo = bar; red = herring;"
compressed = compressed.gsub(/\s*([=;])\s*/,"#$1")
puts compressed
produces
foobarredherring
but I would like it to produce
foo=bar;red=herring;
Seems like the #$1 is not working. I also tried #{$1} but that didn't
work either.
Any ideas?
Thanks,
Peter
I'm trying to remove unecessary white space around equals signs and
after semicolons
compressed = "foo = bar; red = herring;"
compressed = compressed.gsub(/\s*([=;])\s*/,"#$1")
puts compressed
produces
foobarredherring
but I would like it to produce
foo=bar;red=herring;
Seems like the #$1 is not working. I also tried #{$1} but that didn't
work either.
Any ideas?
Thanks,
Peter