Item2211: IfDefinedPlugin: Nested quantifiers in regex

pencil
Priority: Normal
Current State: No Action Required
Released In:
Target Release: n/a
Applies To: Extension
Component: IfDefinedPlugin
Branches:
Reported By: AndreLichtsteiner
Waiting For:
Last Change By: AndreLichtsteiner
Following code results in an error: Nested quantifiers in regex.

%IFDEFINED{"%VAR%" as="C++" then="true" else="false"}%

It seems, that only the 'as' part is sensitive to the letters '++'. We expect, that other regex like letter combination might result in errors too.

-- AndreLichtsteiner - 05 Oct 2009

Try

%IFDEFINED{"%VAR%" as="C\+\+" then="true" else="false"}%

The as parameter is used as a regular expression. Well and + is an iterator quantifier with ++ being an invalid expression.

Whenever possible: try to use %IF instead of %IFDEFINED. The former is much more capable and performing better as well.

To prevent to escape the double + try the %IF equivalent of that test:

%IF{"$VAR='C++'" then="true" else="false"}%

Basically this is not really an error of IfDefinedPlugin, only an annoyance ... which is avoided best as outlined above.

-- MichaelDaum - 05 Oct 2009

Ciao Michael

The error occurs in an Wiki application organizing topics with tags and categories wink

The applications crashes with a tag named 'C++', we do not program the faulty line manually.

-- AndreLichtsteiner - 05 Oct 2009

ItemTemplate edit

Summary IfDefinedPlugin: Nested quantifiers in regex
ReportedBy AndreLichtsteiner
Codebase
SVN Range Foswiki-1.0.7, Sun, 20 Sep 2009, build 5061
AppliesTo Extension
Component IfDefinedPlugin
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r3 - 05 Oct 2009, AndreLichtsteiner
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy