Looks like that some combinations of characters in a regex expression may break the syntax highlight. At least for PHP. I’ve noticed this since few versions of sublime, so it’s not something new.
Here is a screenshot:
Looks like that some combinations of characters in a regex expression may break the syntax highlight. At least for PHP. I’ve noticed this since few versions of sublime, so it’s not something new.
Here is a screenshot:
can you share your example as a formatted code block please? so we can copy and paste it into ST?. So far, I haven’t been able to replicate on build 3125. What build are you using?
This is the code:
$preg1 = preg_replace('/([\(\)\$\-\.\/\\\])/', '\\\$1', $term);
I am on build 3125 too.
looks like you are escaping the ]
, which is causing it to not recognize/expect the closing quote/apostrophe. If you change it to: $preg1 = preg_replace('/([\(\)\$\-\.\/\\\\])/', '\\\$1', $term);
then it will work.
Also you don’t need to escape all those characters in a character class, the following should also work just as well:
$preg1 = preg_replace('/([()$\-.\/\\])/', '\\\$1', $term);
not sure, but maybe you don’t even need to escape the /
.
Yes, true, looks like there is a lot of escaping in that code. But indeed, if I stop escaping the ] it works.
Thanks.