Tamino XQuery User Guide - Software AG Documentation
Tamino XQuery User Guide - Software AG Documentation
Tamino XQuery User Guide - Software AG Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Text Retrieval<br />
<strong>XQuery</strong> Function Call<br />
tf:containsText($a, " ")<br />
tf:containsText($a, " ")<br />
tf:containsText($a, ' *")<br />
tf:containsText($a, ' *")<br />
tf:containsText($a, " ")<br />
tf:containsAdjacentText($a, 1, " ", " ")<br />
tf:containsNearText($a, 1, " ", " ")<br />
tf:containsNearText($a, 1, " *", "* ")<br />
Matching Samples<br />
1, 2, 3<br />
—<br />
1, 2, 3, 4<br />
1, 2, 3<br />
3<br />
—<br />
3, 4<br />
The Escapecard Character<br />
With the help of the escapecard character you can negate any special meaning of the following<br />
single character. By default, the escapecard character is the backslash character "\". Use it if you<br />
want to look for any of the maskcard, escapecard or wildcard characters as literal characters.<br />
Example 1: Escaping an Asterisk<br />
let $text:= text{"** End of code **"}<br />
return tf:containsText($text, "\*\*")<br />
Here, the match succeeds if there is any two-letter word in $text that consists only of asterisks.<br />
This is true for the first and last words in $text.<br />
Example 2: Escaping a Backslash<br />
The following checks the path separator character that is used in $path and returns the result as<br />
plain text, ordered by platform:<br />
{?serialization method="text" media-type="text/plain"?}<br />
let $path := text{"C:\Program Files\<strong>Software</strong> <strong>AG</strong>\<strong>Tamino</strong>"}<br />
return<br />
( "Path Separators Used
",<br />
"DOS/Windows	: ", tf:containsText($path, "*\\*"), "
",<br />
"UNIX	: ", tf:containsText($path, "*/*"), "
",<br />
"MacOS	: ", tf:containsText($path, "*:*")<br />
)<br />
In the pattern, the path separator character must be enclosed by the regular wildcard character,<br />
since it would not form a word on its own. Provided that the path separator character is defined<br />
as a regular character, the query reports for each platform whether its standard path separator<br />
character is used, although this example is certainly not a bullet-proof method. However, if the<br />
102<br />
<strong>XQuery</strong> <strong>User</strong> <strong>Guide</strong>