I am looking for a JavaScript regex which will escape single quotes but it should not escape single quotes which are already escaped.
Here's a solution
/[^\\]\'|^\'/g