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 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.

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:
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-06-10 - PeterThoeny
 
  • 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.