-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_regex.xml
38 lines (34 loc) · 1.29 KB
/
string_regex.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Paul Daniel (hapdaniel)</author>
<documentationURL></documentationURL>
<description>Perform regexs using YQL. Mainly of use because
pipes V1 cannot do global substitution using variables.
Params
text - the text to apply the regex to. (c. 2000 char limit??)
regex - the expression
replace_with - replace with
modifiers - g/i/s/m
</description>
</meta>
<bindings>
<select itemPath="" produces="XML">
<urls>
<url></url>
</urls>
<inputs>
<key id="text" type="xs:string" paramType="variable" required="true"/>
<key id="regex" type="xs:string" paramType="variable" required="true"/>
<key id="replace_with" type="xs:string" paramType="variable" required="true"/>
<key id="modifiers" type="xs:string" paramType="variable" required="true"/>
</inputs>
<execute><![CDATA[
var reg = new RegExp(regex,modifiers);
text = text.replace(reg,replace_with);
response.object = text;
]]>
</execute>
</select>
</bindings>
</table>