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

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:
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2007-07-03 - VickiBrown
 
  • 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.