You've said what you quoted above is a string, but it's unclear whether you mean this (shortened a bit):
var str = "<tr><td><span class=\'label label-info\'>Dialed...";
...where what you've quoted is what you literally have within quotes, or this (note the backslashes):
var str = "<tr><td><span class=\\'label label-info\\'>Dialed...";
...where what you've quoted is the actual content of the string, not part of a string literal.
The first one above doesn't have any backslashes in it, it has escaped '
characters. The second one has backslashes in it.
To remove the backslahes from the second one:
str = str.replace(/\\/g, "");
When you give a regular expression with the g
flag to replace
, it applies globally throughout the string. Backslashes have special meaning in regular expressions, and so I've had to escape the backslash (with another backslash, it's the escape character for regular expressions as well as strings). So in the above, I'm saying to replace all backslashes with an empty string.