I have a string like "localhost,GEWTESTID" or "GEWTESTID,localhost,somethingelse" etc.
Now I would like as an output = GEWTESTID
The string is always starts with "GEW" and 6 chars are following.
So what I need:
This I need working for Zapier Javascript code.
Thank you very much!
We can try using string match() here with the pattern \bGEW.{0,6}\b:
var inputs = ["localhost,GEWTESTID", "GEWTESTID,localhost,somethingelse"];
inputs.forEach(x => console.log(x + " => " + x.match(/\bGEW.{0,6}\b/)[0]));
To extract the Zapier substring, use:
var input = "localhost,GEWTESTID";
var zapier = input.match(/\bGEW.{0,6}\b/)[0];