I have a macruby project in xcode, in which I want to replace all the left and right quotes in a string with ~@@~@@~"
and "~@@~@@~
, respectively. I tested the following code in rubular.com, and it works correctly.
string.gsub!(/\B"/, "~@@~@@~\"")
string.gsub!(/\b"/, "\"~@@~@@~")
But when I use this in xcode, it interprets the "
in the regexp as the beginning of the string, and says I have the wrong numer of arguments for gsub
. I tried escaping the quote:
string.gsub!(/\B\"/, "~@@~@@~\"")
string.gsub!(/\b\"/, "\"~@@~@@~")
But that also did not work. Thanks for your help.
EDIT: I managed to get the error to go away, it seems it was due to something else. The highlighting is still off, but I can handle that, since it works.