I'm new with scripting in Switch.<br/>
I would like to replace RegEx Strings by group.
For example a string like 'a1b2c3_DDYYKK_123_ABC_X1Y1Z1'
The replaced string should be the substring between the 2nd and 3rd underscore -> '123'
If I use replace, that does not work.
Does anyone have an idea, why?
Code: Select all
var name = job.getJobState();
var pattern = /(.{0,9}_.{0,9}_)(.{1,9})(_.{1,9}_.{1,9})/;
var newname = name.replace(pattern,$2);
newname;
thank you