Permalink
Browse files

Item14324: Fix some unescaped braces in regex

  • Loading branch information...
gac410 committed Mar 1, 2017
1 parent 5f76c08 commit 61ca6a57acdd05b5241b3d52fff8a25d0e916685
@@ -83,7 +83,7 @@ We cannot do table parsing in commonTagsHandler because by then the TML has been
=cut
sub beforeCommonTagsHandler {
- return unless $_[0] =~ /%EDIT(?:TABLE|CELL){.*}%/;
+ return unless $_[0] =~ /%EDIT(?:TABLE|CELL)\{.*\}%/;
Foswiki::Func::writeDebug(
"EditTablePlugin::beforeCommonTagsHandler( $web.$topic )")
if $debug;
@@ -108,7 +108,7 @@ Calls EditTablePlugin::Core::parseTables for INCLUDEd topics.
=cut
sub commonTagsHandler {
- return unless $_[0] =~ /%EDIT(?:TABLE|CELL|TABLESTUB){.*}%/;
+ return unless $_[0] =~ /%EDIT(?:TABLE|CELL|TABLESTUB)\{.*\}%/;
Foswiki::Func::writeDebug(
"EditTablePlugin::commonTagsHandler( $web.$topic )")
@@ -289,17 +289,17 @@ sub _processTags {
while ( scalar(@queue) ) {
my $token = shift(@queue);
if ( $token =~ /^\n?%$/s ) {
- if ( $token eq '%' && $stackTop =~ /}$/ ) {
+ if ( $token eq '%' && $stackTop =~ /\}$/ ) {
while ( scalar(@stack)
&& $stackTop !~
- /^\n?%(?:~~ )?($Foswiki::regex{tagNameRegex}){.*}$/os )
+ /^\n?%(?:~~ )?($Foswiki::regex{tagNameRegex})\{.*\}$/os )
{
$stackTop = pop(@stack) . $stackTop;
}
}
if ( $token eq '%'
&& $stackTop =~
- m/^(\n?)%(~~ )?($Foswiki::regex{tagNameRegex})({.*})?$/os )
+ m/^(\n?)%(~~ )?($Foswiki::regex{tagNameRegex})(\{.*\})?$/os )
{
my $nl = $1;
my $glue = $2 || '';
@@ -669,11 +669,11 @@ sub TML2PlainText {
$text =~ s/%META:/%<nop>META:/g;
}
else {
- $text =~ s/%META:[A-Z].*?}%//g;
+ $text =~ s/%META:[A-Z].*?\}%//g;
}
if ( $opts =~ m/expandvar/ ) {
- $text =~ s/(\%)(SEARCH){/$1<nop>$2/g; # prevent recursion
+ $text =~ s/(\%)(SEARCH)\{/$1<nop>$2/g; # prevent recursion
$topicObject = Foswiki::Meta->new( $this->{session} )
unless $topicObject;
$text = $topicObject->expandMacros($text);
@@ -685,7 +685,7 @@ sub TML2PlainText {
|| '';
$text =~ s/%WIKITOOLNAME%/$wtn/g;
if ( $opts =~ m/showvar/ ) {
- $text =~ s/%(\w+({.*?}))%/$1/g; # defuse
+ $text =~ s/%(\w+({.*?}))%/$1/g; # defuse
}
else {
$text =~ s/%$Foswiki::regex{tagNameRegex}({.*?})?%//g; # remove
@@ -67,7 +67,7 @@ sub read {
# head meta-data
# NO THIS CANNOT BE /g - TOPICINFO is _only_ valid as the first line!
- $text =~ s<^(%META:(TOPICINFO){(.*)}%\n)>
+ $text =~ s<^(%META:(TOPICINFO)\{(.*)\}%\n)>
<_readMETA($meta, $1, $2, $3, 1)>e;
# WARNING: if the TOPICINFO *looks* valid but has has unrecognisable
@@ -100,7 +100,7 @@ sub read {
if ( $format !~ /^[\d.]+$/ || $format < 1.1 ) {
require Foswiki::Compatibility;
if (
- $text =~ s/^%META:([^{]+){(.*)}%\n/
+ $text =~ s/^%META:([^{]+)\{(.*)\}%\n/
Foswiki::Compatibility::readSymmetricallyEncodedMETA(
$meta, $1, $2 ); ''/gem
)
@@ -110,7 +110,7 @@ sub read {
}
else {
if (
- $text =~ s<^(%META:([^{]+){(.*)}%\n)>
+ $text =~ s<^(%META:([^{]+)\{(.*)\}%\n)>
<_readMETA($meta, $1, $2, $3, 0)>gem
)
{

0 comments on commit 61ca6a5

Please sign in to comment.