Sublime Forum

PHP - MySQL syntax highlight problem

#1

Hello,
I got a problem with syntax higlight i hope you will help me with. I like to start my MySQL code inside PHP files on newline like a guy in this thread:
superuser.com/questions/355766/h … -php-strin

Highlight ok in this example:
$query = "SELECT data
FROM table
WHERE param = 1
";

but no higlight in this example:
$query = "
SELECT data
FROM table
WHERE param = 1
";

so i searched the Packages / PHP / PHP.tmLanguage for a MySql string regexp.
On line 2061 i found this: '\s*(?=(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER)\b)
which should match the case. Unfortunately i wasn’t able to figure out where is the problem.

Can some some experienced user help with this please?

0 Likes

#2

I have the exact same issue.

I’ve been trying to figure out whether or not \s* in the regular expression includes newline characters, or whether the regular expressions are being evaluated as multi-line regex, but haven’t been able to get to the bottom of it. Every regex tester I’ve tried matches the string across multiple lines with \s* matching newlines as well as other whitespace. But ST2 definitely isn’t matching it.

These users are also trying to find an answer:
http://sublimetext.userecho.com/topic/115869-multistring-sql/
http://sublimetext.userecho.com/topic/121497-sql-syntax-highlighting-error-in-concatenated-python-strings/
http://sublimetext.userecho.com/topic/150963-sql-nested-in-a-python-string-is-not-highlighted-if-theres-a-newline-at-the-start-of-the-string/

0 Likes