• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7109: Unmatched [ in regex error when saving configure

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine configure Normal Closed   patch 5.1.4

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


When trying to save the configure settings, configure dies with this message in apache error log:

[error] [client] configure: Unmatched [ in regex; marked by <-- HERE in m/^[ <-- HERE ^\\s\\*?~^\\$@%`/ at /var/www/twiki/lib/TWiki/Configure/Types/REGEX.pm line 55, <DATA> line 1.

Cause: Raw text is put into input field, which terminates a regex string prematurely if the regex contains a double quote, as is the case with {LoginNameFilterIn} and {NameFilter}.

This bug was introduced by Item7067.

Fix: Entity encode ', ", &, <, > before adding regex value to input field.

-- TWiki:Main/PeterThoeny - 2012-12-28


--- lib/TWiki/Configure/Types/REGEX.pm   (revision 24484)
+++ lib/TWiki/Configure/Types/REGEX.pm   (working copy)
@@ -44,6 +44,8 @@
     # while ( $value =~ s/^\(\?\^:(.*)\)/$1/ )     { }
     # $value =~ s/([[\x01-\x09\x0b\x0c\x0e-\x1f"%&'*<=>@[_\|])/'&#'.ord($1).';'/ge;
+    $value =~ s/(['"&<>])/'&#'.ord($1).';'/ge; # escape basic chars for input field
     my $res = '<input name="'.$id.'" type="text" size="55%" value="'.$value.'" />';
     return $res;

-- TWiki:Main/PeterThoeny - 2012-12-28

Summary Unmatched [ in regex error when saving configure
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4, 5.1.3
SVN Range TWiki-5.1.3-trunk, Thu, 27 Dec 2012, build 24584
AppliesTo Engine
Component configure
Priority Normal
CurrentState Closed

Checkins TWikirev:24599 TWikirev:24600
TargetRelease patch
ReleasedIn 5.1.4
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r6 - 2013-02-18 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback