Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 003ec52f8f
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (46 sloc) 1.852 kB
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<sampleQuery>select * from {table} where expression = "(.*)" and text = "The quick brown fox leaps over the lazy dog";</sampleQuery>
<author>Tom Hughes-Croucher (croucher@yahoo-inc.com, @sh1mmer)</author>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id='text' type='type' paramType='variable' required="true" />
<key id='expression' type='type' paramType='variable' required="true" />
<key id='modifiers' type='type' paramType='variable' required="false" />
<key id='replacement' type='xs:string' paramType='variable' required="false" />
<key id='showempty' type='type' paramType='variable' required="false" />
</inputs>
<execute><![CDATA[
var re, match, matches, myResponse;
if (modifiers) {
re = new RegExp(expression, modifiers);
} else {
re = new RegExp(expression);
}
//if there is a replacement for matches
if (replacement) {
match = text.replace(re, replacement);
myResponse = <matches></matches>;
myResponse.match0 += <match0>{match}</match0>
} else {
matches = re.exec(text);
if (matches) {
myResponse = <matches></matches>;
for (i=0;i<matches.length;i++) {
myResponse.node += <match{i}>{matches[i]}</match{i}>;
}
} else if (showempty) {
myResponse = <matches />;
}
}
response.object = myResponse;
]]></execute>
</select>
</bindings>
</table>
Jump to Line
Something went wrong with that request. Please try again.