- or download this
$values = "'abc', 'dec'f', ''ghc''" ;
$sql = "INSERT INTO SOME_TABLE ($columns) VALUES($values) ;
- or download this
'abc' 'dec\'f' '\'ghc\''
- or download this
$insert =~ s/(?<!^)'/\\'/g ; # gives: 'abc\' \'dec\'f\' \'...
# and I tried:
$insert =~ /s(?<!\s)'/\\'/g ; # gives \'abc\' 'dec\'f\'...
- or download this
$insert =~ s/(?<!\s)'|(?<!^)'/\\'/g ; # wrong result :(
$insert =~ s/(?<![^\s]/\\'/g ; # nope again