javascript - RegEx to replace all the double quotes to single quotes in side parenthesis -



javascript - RegEx to replace all the double quotes to single quotes in side parenthesis -

i'm looking single liner regular look should convert double quotes single quotes nowadays in side parenthesis.

ex:

<span onclick="javascript:myfunction("param(s)1", "param(s)2")"

i want above 1 converted to

<span onclick="javascript:myfunction('param(s)1', 'param(s)2')"

i'm novice in regular expressions. please help!

a function is:

function replacequotes(inputstring) { var output = ''; var inbrackets = 0; (i = 0; < inputstring.length; i++) { var currentchar = inputstring.charat(i); switch (currentchar) { case '\"': if (inbrackets > 0) output += '\''; else output += '\"'; break; case '(': inbrackets++; output += '('; break; case ')': inbrackets--; output += ')'; break; default: output += currentchar; break; } } homecoming output; }

if wanting process total html nead more sophistocated this.

javascript regex

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

How do you set up a perforce server to work over the internet? -

ios - Lagging ScrollView with UIWebview inside -