How to extract form a string just the values I need

HI, I’m trying to extract from a string (measure) that sometimes look like “SK1623-0B100153C-02” but can also come as “Name: SV3023-0750AA18A-AA” in both cases I needs the 4 digits that comes after the S* (1623/3023) in some cases in this string I have two values “SJ5122-07418A127-54/SZ5021-06306F8FB-5C” I will need to extract only one of the 2 based on the letter following the S in above example only the second value SZ

I found out that I can manipulate the custom field using Java script while importing so now I have this field with only the needed extract string .

Hi @Shimrit ,

​You might import that using the JavaScript calculated customfield.
Please read more about creating that here - ​Account specific calculated fields.

​The actual code might be something like the following.

if(issue.fields.customfield_NNNNN){
var input = issue.fields.customfield_NNNNN;
// removing the part until first S?999 if that exists
  input = input.substring(input.indexOf("S"));
// creating set of entries
var codes = new Array();
codes = input.split('/');
// creating set of first parts
var versions = new Array();
for (var i=0;i<codes.length;i++){
    versions.push(codes[i].split('-')[0]);
}
// sorting descending
versions.sort();
versions.reverse();
// return the numeric part
return versions[0].substring(2);
}​

Where NNNNN stands for the customfield ID of the source value.

Regards,
​Oskars / ​support@eazyBI.com