Tags:
create new tag
view all tags

Question

Based on the description in page http://twiki.org/cgi-bin/view/TWiki04/RegularExpression

I think %SEARCH{ "[Aa].*" scope="topic" order="topic"... can find out all topics that have topic name begin with A (ignore case).

But actually topics like WebSearch or WebLeftBar that have 'a' in the middle also appear in the result. What is the problem?

Environment

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

-- MagicYang - 19 Dec 2007

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.

%SEARCH{ "^[Aa].*" scope="topic" order="topic" type="regex" format="   * $topic" limit="16" }%
Search: ^[Aa].*

Number of topics: 16

But -- ähm -- it's pretty unlikely that you will get topics starting with a lowercase letter. wink
And SEARCH ignores case anyway until you use casesensitive="on".

More interesting is a search for topics ending with a certain letter. This can be done by something like:

%SEARCH{ ".*[A]$" scope="topic" order="topic" type="regex" casesensitive="on" format="   * $topic" limit="16" }%
Search: .*[A]$

Number of topics: 1

Regular expressions are fascinating, indeed.

-- FranzJosefGigler - 19 Dec 2007

Thanks a lot! You are really good that the knowledge and sample should be put in RegularExpression topic in formal documents. There are too little information in these documents.

-- MagicYang - 20 Dec 2007

Change status to:
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2007-12-20 - MagicYang
 
  • 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.