Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not a one liner regex, but I think it is safer to do it this way:</p> <pre><code> json_string = '{"description":"This is my 12" pizza: which can also contain other "," which would break in a one liner regex.","value":"1"}'; console.log(json_string); // save the value for later use var value = json_string.match(/"value":"(.+)"}$/)[1]; // isolate just the description value.. // remove the ","value... from the end var desc = json_string.replace(/","value":".+"}$/, ''); // remove the opening {"description":" from the description value desc = desc.replace(/^{"description":"/, ''); // any remaining " in the description are unwanted to replace them desc = desc.replace(/"/g, '&amp;quot;'); console.log(desc); // now put it all back together - if you wanted too - but really you already have the description and value parsed out of the string json_string = '{"description":"'+desc+'","value":"'+value+'"}' console.log(json_string); </code></pre> <p>The console output looks like:</p> <pre><code>{"description":"This is my 12" pizza: which can also contain other "," which would break in a one liner regex.","value":"1"} This is my 12&amp;quot; pizza: which can also contain other &amp;quot;,&amp;quot; which would break in a one liner regex. {"description":"This is my 12&amp;quot; pizza: which can also contain other &amp;quot;,&amp;quot; which would break in a one liner regex.","value":"1"} </code></pre> <p><strong>NOTE</strong> This method won't break if say the description also contained any of the patterns that you might use in as part of a regex one liner</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload