benf1012
12/14/2016 - 4:48 PM

Regex (Regular expression) to remove comments from SQL Text.

Regex (Regular expression) to remove comments from SQL Text.

// Remove the / * * / style comments
$subject = preg_replace('%(/\*)(.*?)(\*/)%s',"",$subject);
// Remove the — style comments
$subject = preg_replace('%(–).*%',"",$subject);