Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def escape_quotes(str)
- if str
- result = str.gsub(/(\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"'])/u) {|match| ESCAPE_MAP[match] }
- else
- ''
- end
- end
- escapedStr = escape_quotes(string)
- puts escapedStr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement