182
rated 0 times
[
188]
[
6]
/ answers: 1 / hits: 22192
/ 13 Years ago, fri, december 2, 2011, 12:00:00
I have to escape two special characters and , in the string with the following rules.
Example:-
- Mercury should be converted into Mercury
- Mercu,ry should be converted into Mercu,ry
- Mercu,ry should be converted into Mercu,ry
Rules:-
- Meaning comma or double quote should be escaped with double quote.
- Comma will escaped by wrapping the whole word in double quotes.
- If Double quote is found, then it double quote should be added at its
position. Also the whole word should be wrapped inside the double
quotes.
Please suggest the regex pattern in javascript.
More From » regex