Skip to content

Commit

Permalink
Merge pull request #17 from snitsan/master
Browse files Browse the repository at this point in the history
Use the string.match regex instead of RegExp.
  • Loading branch information
kenorb committed Nov 23, 2014
2 parents a1d8961 + cdbea69 commit d5220f7
Showing 1 changed file with 25 additions and 33 deletions.
58 changes: 25 additions & 33 deletions regex/regex.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,35 @@
<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>
var re, match, matches, myResponse,patt;
//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);
} else {
if (modifiers) {
patt = /expression/modifiers;
} else {
patt = /expression/;
}
matches = text.match(patt);
if (matches) {
myResponse = <matches></matches>;
for (i=0;i<matches.length;i++){
myResponse.node += <match{i}>{matches[i]}</match{i}>;
}
if (matches) {
myResponse = <matches></matches>;
} else if (showempty) {
myResponse = <matches />;
}
for (i=0;i<matches.length;i++) {
myResponse.node += <match{i}>{matches[i]}</match{i}>;
}
}
response.object = myResponse;
} else if (showempty) {
myResponse = <matches />;
}
}
response.object = myResponse;
]]></execute>
]]></execute>
</select>
</bindings>
</table>

0 comments on commit d5220f7

Please sign in to comment.