Question
As near as I can tell, ^ does not anchor beginning of line in the pattern argument for
%INCLUDE%
Am I misunderstanding?
Environment
--
VickiBrown - 27 Jun 2007
Answer
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