Tags:
create new tag
view all tags

Question

Hello,

How can I accomplish this?

I have a group of topics, called CruiseNbr9200 through CruiseNbr 9299. I also have another group called OnboardPgm9200 thru OnboardPgm9299.

They are related by the number (CruiseNbr9214 goes with OnboardPgm9214, etc).

I have a search that finds all the CruiseNbrXXXX topics and returns a topic link & a pattern from the text in that topic in a table.This works fine.

I want to add to this search, to return some text from the corresponding ProgrammingXXXX file in that same table. I want to return the rest of the line after the text "Theme: "

So I am trying to nest this search inside the other one.

The 2nd search works fine standalone, outside of its "nest":

%SEARCH{ ".*" topic="OnboardPgm92*" scope="text" regex="on" nosearch="on" nototal="on" format="$pattern(.*?Theme\:\s*([^\n]*).*) "}%

But not inside the other search (returns nothing)


%SEARCH{ ".*" topic="CruiseNbr92*" order="$topic" scope="text" regex="on" nosearch="on" nototal="on" format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: %SEARCH{ ".*" topic="OnboardPgm$percntCALC{$REPLACE($topic, 0, 10)}$percnt" scope="text" regex="on" nosearch="on" nototal="on" format="$pattern(.*?Theme\:\s*([^\n]*).*) "}% | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE(\$topic, 0, 10)}$percnt]] | "}%

I also tried

%SEARCH{ ".*" topic="CruiseNbr92*" order="$topic" scope="text" regex="on" nosearch="on" nototal="on" format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: $percntSEARCH{ $quot.*$quot topic=$quotOnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt$quot scope=$quottext$quot regex=$quoton$quot nosearch=$quoton$quot nototal=$quoton$quot format=$quot$pattern(.*?Theme\:\s*([^\n]*).*) $quot}$percnt | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE(\$topic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE(\$topic, 0, 10)}$percnt]] | "}%


escaping everything but it also returns nothing.

I'm a little confused with the different kinds of escaping... $percnt, \ - maybe this is my problem?

Can someone help?

Thanks!

Kathy

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Windows 2003
Web server: Apache 2
Perl version: indigo perl 5.86
Client OS: Windows
Web Browser: IE, Firefox
Categories: Search

-- KathyDeLaCruz - 29 Oct 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Note: I also just tried something I'd missed in FormattedSearch - putting $nop% to escape the }% sequence

But still no luck.

-- KathyDeLaCruz - 29 Oct 2008

I'm not sure that $quot works in that context. Also, \$ doesn't escape a $ sign, you need $dollar.

How about this:

%SEARCH{ ".*"
   topic="CruiseNbr92*"
   order="$topic"
   scope="text"
   regex="on"
   nosearch="on"
   nototal="on"
   format="| $pattern(.*?Cruise\s*([0-9]+).*): $pattern(.*?Cruise\s*[0-9]*\s*-\s*([^\n]*).*); Theme: $percntSEARCH{\".*\" topic=\"OnboardPgm$percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt\" scope=\"text\" regex=\"on\" nosearch=\"on\" nototal=\"on\" format=\"$pattern(.*?Theme\:\s*([^\n]*).*) \"}$percnt | [[$topic][Description]] | [[OnboardPgm$percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt][Onboard Programming $percntCALC{$REPLACE($dollartopic, 0, 10)}$percnt]] |"
}%

-- SeanCMorgan - 29 Oct 2008

Thank you for your extremely quick reply!

But it still does not work ... I made a mockup in the sandbox - much easier to see than here.

If you have a moment, check out KdlcCs2009

You should see results returned for 9201 and 9204. But the Theme does not display.

-- KathyDeLaCruz - 29 Oct 2008

There were a few things going on:

  1. Cruise\:\s didn't match, because there was no colon in the text of the topic.
  2. Your first screenshot shows 201 instead of 9201 because you only needed to replace 9 characters
  3. Most importantly, $ in the nested SEARCH had to be escaped as $dollar.
  4. SEARCH defaults to scope=text, and nonoise includes nosearch and nototal. I used those to shorten this a bit, so there is less escaping to do and it's a bit easier to read.

Cruise Theme
9201 - South America Celebration Smithsonian Journeys
9204 - Sunset Sampler Wine & Food Festival

These cruises sound great! Have I earned a discount yet smile

-- SeanCMorgan - 01 Nov 2008

Thank you! You're a genius & I really appreciate your time - I was so frustrated, but I knew it had to be possible!

Slowly I will get this regex/search stuff....

If I were in charge of discounts, you'd DEFINITELY have one -- but I'm pretty low on the totem pole here wink

-- KathyDeLaCruz - 03 Nov 2008

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2008-11-03 - KathyDeLaCruz
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.