@FabSa gave me the answer.
The trick is just set the PCRE_DOTALL
flag, as I'm using PHP _preg_match()
. This does make a dot (.
) metacharacter matches all characters, incluind newline (\n
).
So, the final regex is as folows:
/^(?!.*\-\-)(?!.*\/\*)(?!.*\*\/)(?!.*;)(?!.*CREATE)(?!.*DROP)(?!.*ALTER)(?!.*UPDATE)(?!.*DELETE).*$/s