I'm taking this post as reference where they suggest this solution:
Current
Str = 'MyLongString:StringIWant;'
Desired Output
newStr = 'StringIWant'
Solution
var mySubString = str.substring(
str.lastIndexOf(":") + 1,
str.lastIndexOf(";")
);
but what if i have multiple incidence? in my case i have a long text, lets say:
str = 'MyLongString has :multiple; words that i :need; to :extract;'
New desired output:
strarray = ["multiple","need","extract"]
When i apply the suggested solution its just getting the last word "extract"