Tags:
create new tag
, view all tags

Question

As near as I can tell, ^ does not anchor beginning of line in the pattern argument for %INCLUDE%

Am I misunderstanding?

Environment

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

-- VickiBrown - 27 Jun 2007

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.

No, you are not misunderstanding. To be honest, I couldn't figure out the solution from the documentation at TWiki.IncludeTopicsAndWebPages nor from a glance at the code, I've been using the experimental approach.

The analytical part: The pattern operand in %INCLUDE{... pattern="..."}% is applied not per line, but to the topic as a whole, so the caret ^ matches only at the beginning of the whole topic. But this is only why the simple approach doesn't work, and no solution. In the case that you want to use the caret to match "a line containing 'foo' from its beginning to its end" look at Sandbox/CaretInRegexWithINCLUDE, where I demonstrate how to achieve that: Instead of ^.*foo, write [^\r\n]*foo, so the complete regex would read ^.*?([^\r\n]*foo.[^\r\n]*).*

-- HaraldJoerg - 29 Jun 2007

thanks!

-- VickiBrown - 03 Jul 2007

 
Change status to:
Topic revision: r3 - 2007-07-03 - VickiBrown
 
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.