hello ,
I'm using regular expressions, but the code does not work in SwitchScripter. Follows the code.
var re = /(w+)s(w+)/;
var str = "John Smith";
var newstr = str.replace(re, "$2, $1");
job.log(3,newstr);
output -> "$2, $1"
Best Regards
Marcelo Pedrazzani
Regular Expression
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Regular Expression
Try
var str = "John Smith";
var newstr = str.replace(/(w+)s(w+)/g, "2, 1");
job.log(3,newstr);
var str = "John Smith";
var newstr = str.replace(/(w+)s(w+)/g, "2, 1");
job.log(3,newstr);
-
- Newbie
- Posts: 3
- Joined: Tue Aug 19, 2014 2:50 pm
Regular Expression
Thank you . It worked very well.
Marcelo Pedrazzani.
Marcelo Pedrazzani.