I have a question that is almost identical to "Ruby gsub multiple characters in string".
However, my string contains special characters:
a = "<p>text</p> <strong>bold</strong> and <em>italic</em>"
Using /\w+/
doesn't work for me.
I tried many different combinations, but no luck.
What RegEx match should I enter below to make it work? I want to replace those matches wherever they are in the string.
By the way I am using Rails.
My desired matches are:
a.gsub({{WHAT REGEX EXP?}},
"\r\n" => "",
"<p>" => "",
"</p>" => "\n\n",
"<br />" => "\n",
"<strong>" => "*",
"</strong>" => "*",
"<em>" => "_",
"</em>" => "_",
"<s>" => "~",
"</s>" => "~",
"<blockquote>" => ">",
"</blockquote>" => ">",
"&" => "&",
"<" => "<",
">" => ">"
)