Tags:
create new tag
view all tags

Question

I am trying to find multiple matches within one topic using search.

MultipleSearchesInSameTopic discusses this, still it does not work for me.

example

I would like to extract the names of all contributors to this topic. I assume it starts with "Main" and would like to print the part after it.

in

%SEARCH{ "-- Main" topic="HowtoMultipleSearchesInSameTopic" multiple="on" scope="text" regex="on" nosearch="on" nototal="on" format="$pattern(.*Main(.*)) $n"}%

out

)

)

)

)

)

)

SearchDotPm

The code handles this via

                
   $tempVal =~ s/\$pattern\((.*?\s*\.\*)\)/getTextPattern( $text, $1 )/geos;

It is especially unclear to me how this is supposed to handle nested '(' ')'

Still it seems to work for the rest of the world. What am I doing wrong?

-- FrankHartmann - 08 Nov 2004

Environment

TWiki version: TWikiRelease01Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Search

-- FrankHartmann - 08 Nov 2004

Answer

in

%SEARCH{ "-- \[*Main" format="$pattern(.*-- \[*(Main.[^ \]\n\r]+).*) $n" topic="HowtoMultipleSearchesInSameTopic" multiple="on" scope="text" regex="on" nosearch="on" nototal="on"}%

out

FrankHartmann

FrankHartmann

SamHasler

SamHasler

SamHasler

SamHasler

shake it all about

That's modified from the example FormattedSearch

The documentation could perhaps do with some more verbose explanations for the examples to explain why they were written the way they are, and a troubleshooting sections of common problems with examples that don't work and how they should be written.

Let's also have a sig without a date because you probably want it to pick up those.

-- SamHasler

There are other common formats that this might not pick up.

  • Does it pick up initials? -- SH - 08 Nov 2004
  • Does it pick up initials, without a date? -- SH

yes it does smile

-- SamHasler - 08 Nov 2004

Sam, many thanks. I missed the documented limitation:

_Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does _

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2004-11-09 - FrankHartmann
 
  • 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.