Date: Thu, 26 Apr 2001 17:13:41 +0100
Message-ID: <
20010426171341.A27299@puffinry.freeserve.co.uk>
Subject: Re: [PATCH B::Deparse] fix string uninterpretation
From: Robin Houston <robin@kitsite.com>
Date: Thu, 26 Apr 2001 18:44:29 +0100
Message-ID: <
20010426184429.A27734@puffinry.freeserve.co.uk>
p4raw-id: //depot/perl@9856
# but not character escapes
sub uninterp {
my($str) = @_;
- $str =~ s/(^|[^\\])([\$\@]|\\[uUlLQE])/$1\\$2/g;
+ $str =~ s/(^|\G|[^\\])((?:\\\\)*)([\$\%\@]|\\[uUlLQE])/$1$2\\$3/g;
return $str;
}
-# the same, but treat $|, $), and $ at the end of the string differently
+# the same, but treat $|, $), $( and $ at the end of the string differently
sub re_uninterp {
my($str) = @_;
- $str =~ s/(^|[^\\])(\@|\\[uUlLQE])/$1\\$2/g;
- $str =~ s/(^|[^\\])(\$[^)|])/$1\\$2/g;
+ $str =~ s/(^|\G|[^\\])((?:\\\\)*)([\$\%\@](?!\||\)|\$\(|$)|\\[uUlLQE])/$1$2\\$3/g
+;
return $str;
}