Escaped quotes not handled properly with syntax colors
Posted: Tue Nov 16, 2021 2:51 am
I have a Perl script that uses the following substitution regex to replace double quotes with a backslash + double quote combo:
(Since the backslash is not showing up in the code sample below after posting, I'm going to use a vertical bar in place of where the real code has a backslash.)
$str =~ s/|"/||"/isg;
However, the editor gets confused by this and thinks everything after the second double quote is now a literal string and colors it in that defined color.
If I remove one of the backslashes prior to the second double quote, the remainder of the script's colors are displayed properly.
Is this something I can fix in a config or syntax file or is this an issue that requires a code change?
Thanks!
(Since the backslash is not showing up in the code sample below after posting, I'm going to use a vertical bar in place of where the real code has a backslash.)
$str =~ s/|"/||"/isg;
However, the editor gets confused by this and thinks everything after the second double quote is now a literal string and colors it in that defined color.
If I remove one of the backslashes prior to the second double quote, the remainder of the script's colors are displayed properly.
Is this something I can fix in a config or syntax file or is this an issue that requires a code change?
Thanks!