Answers for "javascript replace char if not present another character"

0

javascript replace char if not present another character

var arr = ["pippo%12pluto%_prova", "ori%_aa"];

for (i=0; i<arr.length; i++) {
   console.log( arr[i] + ' => ' + arr[i].replace(/(^|[^'])'(?!')/g, "$1''") );
}
Posted by: Guest on September-27-2021
0

javascript replace char if not present another character

var arr = ["abc'def", "abc''de'f"];

for (i=0; i<arr.length; i++) {
   console.log( arr[i] + ' => ' + arr[i].replace(/(^|[^'])'(?!')/g, "$1''") );
}
Posted by: Guest on September-27-2021

Code answers related to "javascript replace char if not present another character"

Code answers related to "Javascript"

Browse Popular Code Answers by Language