We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
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#Extract_some_text_from_a_topic_u

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 _

 
Topic revision: r3 - 09 Nov 2004 - 23:18:36 - FrankHartmann
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback