Reputation: 83
I have an RTF string that contains \*\revtbl{Unknown;}}
, it is used to indecate that the word that follows is misspelled (I think) and I need to remove it, when I do:
.replace(/{\*\revtbl{Unknown;}}/g, "")
I get two lines:
*
evtbl{Unknown;}}
When I change to:
.replace(/{\*\r|evtbl{Unknown;}}/g, "")
I get just the * and a second line. e.g.:
var tt = '\*\revtbl{Unknown;}}';
tt=tt.replace(/{\*\r|evtbl{Unknown;}}/g, "");
alert('"'+tt+'"');
I see:
"*
"
I could not find any reference about the use of the pipe |
character so I need to know: if by using it am I asking to replace two separate strings one being {\*\r
and the other being evtbl{Unknown;}}
bottom line I need to replace the literal string \*\revtbl{Unknown;}}
with nothing.
Upvotes: 1
Views: 103
Reputation: 2733
I think it is just a matter of escaping all the characters correctly
//sample string - NOTE: the backslashes had to be escaped for JS
var str = "RTF string that contains \\*\\revtbl{Unknown;}}, it is used to indecate that the word that follows is misspelled (I think) and I need to remove it, when I do:";
var regEx = /\\\*\\revtbl\{Unknown;\}\}/g;
console.log(str.replace(regEx, ''));
Upvotes: 1