Skip to content

Commit

Permalink
Item11746: search example for grabbing the entire row for each hit
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x01@15753 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
ArthurClemens authored and ArthurClemens committed Oct 28, 2012
1 parent 5ef7671 commit a714d31
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions core/data/System/SearchPatternCookbook.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,39 @@ Which renders as:
}%
</select>

---+++ Solution 3
If you want to grab the complete row for each occurrence of a string in a table, for instance the word "Marketing":
<verbatim class="tml">
| a | b | c | d | e |
| Marketing | b | c | d | e|
| a | b | c | d | e |
| a | marketing | c | d | e |
| a | b | c | d | marketing |
</verbatim>

use this query:
<verbatim class="tml">
%SEARCH{
"^\|.*?Marketing.*"
type="regex"
topic="%TOPIC%"
multiple="on"
nonoise="on"
format="| $pattern(^\| *(.*?) *|.*)"
}%
</verbatim>

Which renders as:
%SEARCH{
"^\|.*?Marketing.*"
type="regex"
topic="%TOPIC%"
multiple="on"
nonoise="on"
format="| $pattern(^\| *(.*?) *|.*)"
}%


<!-- ============================== -->
#SearchFormClassification
---++ Pattern 2: List generated from form classification
Expand Down

0 comments on commit a714d31

Please sign in to comment.