You are here: Foswiki>Tasks Web>Item13051 (05 Jul 2015, GeorgeClark)Edit Attach

Item13051: Cannot do anything useful with a $pattern that contains a quote (").

pencil
Priority: Enhancement
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: SEARCH
Branches: master
Reported By: CrawfordCurrie
Waiting For:
Last Change By: GeorgeClark
If you use a search to locate a topic and then process the topic content using a $pattern, if that $pattern returns a result that contains a " you can't do anything with it - the " will be interpreted as part of the parameter syntax for any macro you call it within.

"Example":

%SEARCH{"Dagnabbit" topic="Item13051" format":$pattern(.*?(.Example.).*):"}% will return
Searched: Dagnabbit
:"Example":
Number of topics: 1

Because the "'s come from the $pattern-matched string (and there's therefore no way to escape them) then this result can't safely be used in a parameter to any other macro frown, sad smile

We require some way to tell $pattern to escape the result.

-- CrawfordCurrie - 10 Oct 2014

Added $extract to do the job without damaging $pattern.

%SEARCH{"Dagnabbit" topic="Item13051" format":$extract(.*?(.Example.).*):"}% will return
Searched: Dagnabbit
:"Example"$:
Number of topics: 1

-- CrawfordCurrie - 31 Oct 2014

 

ItemTemplate edit

Summary Cannot do anything useful with a $pattern that contains a quote (").
ReportedBy CrawfordCurrie
Codebase trunk
SVN Range
AppliesTo Engine
Component SEARCH
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:339abe64cfe8
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:339abe64cfe8
ItemBranchCheckins
Release01x01Checkins
Topic revision: r6 - 05 Jul 2015, GeorgeClark
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