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 have learned several ways to query forms, they all work. But, for heavens sake, I don't know why!!!

For example, this:

%SEARCH{ "[S]chool Type.*value=.[I]nstrumentality"  

What do the brackets around "S" and "I" mean? Why does value have a "*" in front of it? Why is there a "." before the search value, "Instrumentality?"

And, this:

META\:FIELD.*?SchoolType.*?Instrumentality"

What does *? mean? I know if I remove them, it no longer works.

I guess I should be happy that it works, but it bugs me not to understand and I have looked all over the place. Where is the documentation on this?

Environment

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

-- JohnGee - 10 Jun 2008

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

This is a RegularExpression search question. Regular expressions are more powerful than literal search, but they are quite geeky and need some time to learn. TWiki 4.2 offers a QuerySearch that makes advanced somewhat searches easier.

To your questions:

  • [aiueo] finds exactly one vowel, [S] finds exactly one character S. So why a single char in [...]? That is to exclude the search page from showing up in a search result. The same can be achieved with an excludetopic parameter. These two searches are identical
    %SEARCH{ "[S]chool Type.*value.[I]nstrumentality" type="regex" ...=
    %SEARCH{ "School Type.*value.Instrumentality" type="regex" excludetopic="%TOPIC%" ...=
  • .*? is a cautious scan forward ("non greedy search"), skipping over any character until the first pattern following it is found. The greedy .* pattern scans forward and finds the last pattern.

Learn more at RegularExpression, Wikipedia:Regular_expression, http://www.perl.com/doc/manual/html/pod/perlre.html

-- PeterThoeny - 10 Jun 2008

 
Change status to:
Topic revision: r2 - 10 Jun 2008 - 05:36:45 - PeterThoeny
 
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