Tags:
create new tag
, view all tags

Question

How would be the pattern to extract a chunk of text between two arbitrary words that may or not be in the same line. For example:

Welcome to TWiki, a flexible, powerful, 
and easy to use Web-based collaboration platform. 

Use TWiki to run a project development space, 
a document management system, 
a knowledge base, or 
any other groupware tool, on an intranet or on the internet. 

Letīs say I want the text between powerful and tool including both words

powerful, 
and easy to use Web-based collaboration platform. 

Use TWiki to run a project development space, 
a document management system, 
a knowledge base, or 
any other groupware tool

Environment

TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Red Hat Linux release 6.2 (Zoot) Kernel 2.2.14-5.0smp
Web server: Apache 3.0.99-563
Perl version: 5.005, 5.6.1
Client OS: MS Windows 98SE,
Web Browser: IE 6

-- AntonioVega - 09 Oct 2003

Answer

Do an INCLUDE with a pattern; the pattern search goes over multiple lines. Here is how to grab the text from your example on this topic:

%INCLUDE{ "%TOPIC%" pattern="^.*?(powerful.*?tool).*" }%

does this:

powerful, and easy to use Web-based collaboration platform.

Use TWiki to run a project development space, a document management system, a knowledge base, or any other groupware tool

IncludeTopicsAndWebPages has more.

-- PeterThoeny - 26 Oct 2003

Topic revision: r2 - 2003-10-26 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.