, , . , SQL , , , . (, .)
100% - , SQL, this. ( " SQL" PHP ". , .)
EDIT:
, , . , - , , , . backrefs .
- , , :
preg_match_all("/(?:([^']*'){2})*[^']*;/U", str_replace("\\'", "\0\1\2", $input), $matches);
$output = array_map(function($str){ return str_replace("\0\1\2", "\\'", $str); }, $matches[0]);
, , , \0\1\2. . , . . ( , PHP 5.3.)
, , .