Moved to
Support.NewlinesAndFormattedSearch
Newlines and Formatted Search
- first topic, than expression
- first expression, than topic
- first expression, than topic, as bullet list
- first expression, than topic, as table
- first expression, than topic, as table, expression ends in front of the line feed
- expression as topic, expression with line feed
- expression as topic, expression without line feed
first topic, than expression
SEARCH String:
Error: no such plugin chili
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format="[[$topic][Open]] $pattern(.*?([A-Z].*?[\n\r]+).*) "
}%
Result:
Question: Are there 2 line feeds behind a result?
Answer: [\n\r] is included inside the (parenthesis), so it includes the newline character(s) that may be found in the topic as a part of the pattern that is extracted. If you don't want the newlines, don't put parenthesis around them (parenthesis mark the bits of a pattern that you want to be extracted into the result)
Corrected version:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format="[[$topic][Open]] $pattern(.*?([A-Z].*?)[\n\r]+.*) "
}%
Result:
first expression, than topic
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format="$pattern(.*?([A-Z].*?(([\n\r])+)).*) [[$topic][Open]] "
}%
Result:
Question: Where are the line feeds?
Answer: They
are there, but in TML, you need
two consecutive linefeeds to make a new paragraph. This is a problem that comes from displaying TML in HTML - HTML does not have a very strong sense of linefeeds; if you want one without creating a new paragraph, you must use
<br/>.
Corrected version:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
separator="<br/>"
format="$pattern(.*?([A-Z].*?)[\n\r]+.*) [[$topic][Open]] "
}%
Result:
first expression, than topic, as bullet list
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format=" * $pattern(.*?([A-Z].*?(([\n\r])+)).*) [[$topic][Open]] "
}%
Result:
Question: Why is it now OK?
Answer: The previous answer probably makes this clear: anyway, in TML, you only need one linefeed to separate bullet list items. So the bullets work fine in this example.
first expression, than topic, as table
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nosearch="on"
header="| *Department* | *Topic* |"
format="| $pattern(.*?([A-Z].*?(([\n\r])+)).*) | [[$topic][Open]] |"
}%
Result:
Number of topics: 0
Question: Why no table?
Answer: Too many linefeeds

You can't have linefeeds in the middle of a table. They may only be used to finish a table row. If you want linefeeds within a table cell, the newlines need to be converted to
<br/>.
Here is a fixed version, which avoids extracting the newline characters:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nosearch="on"
header="| *Department* | *Topic* |"
format="| $pattern(.*?([A-Z].*?)[\n\r]+.*) | [[$topic][Open]] |"
}%
Result:
Number of topics: 0
first expression, than topic, as table, expression ends in front of the line feed
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nosearch="on"
header="| *Department* | *Topic* |"
format="| $pattern(.*?([A-Z].*?(([^\n\r])+)).*) | [[$topic][Open]] |"
}%
Result:
Number of topics: 0
Question: No question, it works
Note: This one is different the other examples. It matches non-newline characters using
[^\n\r] instead of previous patterns that used
[\n\r]
expression as topic, expression with line feed
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format="[[$topic][$pattern(.*?([A-Z].*?(([\n\r])+)).*)]]"
}%
Result:
Question: Why no function?
Answer: Linefeeds again. You can't have a
[[link with a
newline in it]]
You don't "see" the newline because in TML, single newlines are ignored - you only get new paragraphs if there are two consecutive newlines.
Here is a corrected version:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
separator="<br/>"
format="[[$topic][$pattern(.*?([A-Z].*?)[\n\r]+.*)]]"
}%
Result:
expression as topic, expression without line feed
SEARCH String:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
format="[[$topic][$pattern(.*?([A-Z].*?(([^\n\r])+)).*)]]"
}%
Result:
Question: Why no line feed?
Answer: Again, in TML, single newlines are ignored. You must separate results with two linefeeds to generate separate paragraphs or use
<br/>. Corrected version:
%SEARCH{
"NewlinesAndFormattedSearch"
scope="topic"
nonoise="on"
separator="<br/>"
format="[[$topic][$pattern(.*?([A-Z].*?(([^\n\r])+)).*)]]"
}%
Result:
--
AndreasEllguth - 07 Apr 2010
This topic: Sandbox
> SandboxAndreas
Topic revision:
07 Apr 2010, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. 
