You are here: PSPad forum > English discussion forum > Re: Perl highlighter has bugs with dbl quotes in regex
Posted by: therium | Date: 2014-03-28 12:29 | IP: IP Logged
Win 7 with PSPad 4.5.7
This will help explain it: imgur.com
Double quotes in a Perl regex do not have to be escaped. So the Perl highlighter in PS Pad does not work correctly. Since I have an odd number of double quotes, PSPad thinks everything after the third quote is in a string.
Example: $s=~s/""/"/g; # Not highlighted properly
If I escape the double quotes, PSPad highlights properly. But not sure if my program would work right then.
Example: $s=~s/\"\"/\"/g; # Highlighted properly but may not work in Perl
I deal with a lot of spreadsheet data which, when saved as a text file, inch marks come out as 2 double quotes. So I have to change each pair of double quotes to one dbl quote.
Thanks!
Posted by: vbr | Date: 2014-03-29 00:43 | IP: IP Logged
therium:Win 7 with PSPad 4.5.7This will help explain it: imgur.com
Double quotes in a Perl regex do not have to be escaped. So the Perl highlighter in PS Pad does not work correctly. Since I have an odd number of double quotes, PSPad thinks everything after the third quote is in a string.
Example: $s=~s/""/"/g; # Not highlighted properly
If I escape the double quotes, PSPad highlights properly. But not sure if my program would work right then.
Example: $s=~s/\"\"/\"/g; # Highlighted properly but may not work in Perl
I deal with a lot of spreadsheet data which, when saved as a text file, inch marks come out as 2 double quotes. So I have to change each pair of double quotes to one dbl quote.
Thanks!
Hi,
there are indeed some problems in highlighting these kind of cases.
The autor of PSPad could say, whether it is fixable in the current state,
but you can generally work around it by placing another quote in the nearest suitable position, e.g. at the end of the offending line - of course, as a comment,
I believe, escaping with \ directly in the regex pattern should work here too - I don't know perl, but as far as I know, in regex the backslashed characters should behave the same like the "raw" ones, unless they are defined escape sequences - in regex like \w or in the string literals - which \" shouldn't be.
hth,
vbr
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR