I have this code that works quite well and returns my String: "91308543 91502466 91502466 91503362 91503362 91308543 9851236".
function f () {
var text = ("91308543 91502466 91502466 91503362 91503362 91308543 9851236");
var regex = /(9\d{7})/gm;
var compare = text.match(regex);
var result = compare.join(", ");
return result; }
f ();
My problem is that I want to get rid of the duplicate numbers. I have tried in a JS Console to use this Regex instead: "/(9\d{7})(?!.*\1)/gm;" and it works, but unfortunately in the engine that I use (Esko Automation Engine) is not working at all. I receive this error:
javax.script.ScriptException:TypeError:null has no such function"join" in at line number 9.
Does anyone know a solution or another way to not return the duplicate numbers in the string?