3
我有這些花哨的雙引號的文本:''',我想用普通的雙引號替換它們,使用Ruby gsub和regex。下面是一個例子,我有什麼至今:使用Ruby正則表達式轉換爲'''正則表達式使用Ruby正則表達式
sentence = 'This is a quote, 「Hey guys!」'
I couldn't figure out how to escape double quotes so I tried using 34.chr:
sentence.gsub("「",34.chr). This gets me close but leaves a back slash in front of the double quote:
sentence.gsub("「",34.chr) => 'This is a quote, \"Hey guys!」'