Skip to content

Commit

Permalink
Item13933: Escape { } in regexes for perl 5.22
Browse files Browse the repository at this point in the history
I've tested successfully against the IfDefinedPlugin topic only
  • Loading branch information
Jlevens committed Jan 26, 2016
1 parent 91a515c commit 15e7320
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Foswiki/Plugins/IfDefinedPlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ sub commonTagsHandler {
$currentTopic = $_[1];
$currentAction = '';

$_[0] =~ s/(\s*)%IFDEFINED{(.*?)}%(\s*)/&handleIfDefined($2, $1, $3)/geos;
$_[0] =~ s/(\s*)%IFDEFINED\{(.*?)\}%(\s*)/&handleIfDefined($2, $1, $3)/geos;
$_[0] =~ s/(\s*)%IFACCESS%(\s*)/&handleIfAccess(undef, $1, $2)/geos;
$_[0] =~ s/(\s*)%IFACCESS{(.*?)}%(\s*)/&handleIfAccess($2, $1, $3)/geos;
$_[0] =~ s/(\s*)%IFEXISTS{(.*?)}%(\s*)/&handleIfExists($2, $1, $3)/geos;
while ($_[0] =~ s/(\s*)%IFDEFINEDTHEN{(?!.*%IFDEFINEDTHEN)(.*?)}%(.*?)%FIDEFINED%(\s*)/&handleIfDefinedThen($2, $3, $1, $4)/geos) {
$_[0] =~ s/(\s*)%IFACCESS\{(.*?)\}%(\s*)/&handleIfAccess($2, $1, $3)/geos;
$_[0] =~ s/(\s*)%IFEXISTS\{(.*?)\}%(\s*)/&handleIfExists($2, $1, $3)/geos;
while ($_[0] =~ s/(\s*)%IFDEFINEDTHEN\{(?!.*%IFDEFINEDTHEN)(.*?)\}%(.*?)%FIDEFINED%(\s*)/&handleIfDefinedThen($2, $3, $1, $4)/geos) {
# nop
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ sub handleIfDefinedThen {
my $theThen = $text;
my $theElse = '';
my $elsIfArgs = '';
if ($text =~ /^(.*?)\s*%ELSIFDEFINED{(.*?)}%(.*)$/gos) {
if ($text =~ /^(.*?)\s*%ELSIFDEFINED\{(.*?)\}%(.*)$/gos) {
$theThen = $1;
$elsIfArgs = $2;
$theElse = $3;
Expand Down

0 comments on commit 15e7320

Please sign in to comment.