C
ciapecki
please help me how to solve following replaceing: \\char_code into
\char_code
having string2 = "\\303\\274" I want to get string = "\303\274", so
that after calling puts on this string I will get special character and
not the number of this special character
irb(main):001:0> string2 = "\\303\\274"
=> "\\303\\274"
irb(main):002:0> puts string2
\303\274
=> nil
I can do so:
irb(main):003:0> puts string2.gsub('\\303\\274',"\303\274").inspect
"\303\274"
=> nil
and so:
irb(main):004:0> puts string2.gsub(/\\\d{3}\\\d{3}/,"\303\274").inspect
"\303\274"
=> nil
but when I want to replace every occurance of any 3 digit number
comming after '\' sign it does not work as I expect:
irb(main):005:0> puts string2.gsub(/\\\d{3}\\\d{3}/,'\\1\\2').inspect
""
=> nil
can anybody tell me how to replace those backslashes?
thanks
chris
\char_code
having string2 = "\\303\\274" I want to get string = "\303\274", so
that after calling puts on this string I will get special character and
not the number of this special character
irb(main):001:0> string2 = "\\303\\274"
=> "\\303\\274"
irb(main):002:0> puts string2
\303\274
=> nil
I can do so:
irb(main):003:0> puts string2.gsub('\\303\\274',"\303\274").inspect
"\303\274"
=> nil
and so:
irb(main):004:0> puts string2.gsub(/\\\d{3}\\\d{3}/,"\303\274").inspect
"\303\274"
=> nil
but when I want to replace every occurance of any 3 digit number
comming after '\' sign it does not work as I expect:
irb(main):005:0> puts string2.gsub(/\\\d{3}\\\d{3}/,'\\1\\2').inspect
""
=> nil
can anybody tell me how to replace those backslashes?
thanks
chris