Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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''") );
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #replace #char #present #character
ADD COMMENT
Topic
Name
6+3 =