javascript - Replace two double quotes with single one using jquery -


how replace 2 double quotes single 1 using jquery?

for example: need replace

sam @ ""home""

to

sam @ "home"

looking similar regex (which replaces double quotes single quotes):

mystring.replace(/"/g, "'") 

try this:

mystring = mystring.replace(/""/g, '"'); 

the regex captures 2 double quotes , replaces them one. we're using regex replace more single match (javascript's replace replace first one).

note second argument replace string. represent " in string need escape it: "\"", or use single quote string: '"'. javascript supports both.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -