Here I have text something like this:
const string = 'Welcome;;to::';const string ='Welcome;;';
I want to split this string with ;; and ::;
Expected result:
['Welcome', ';;', 'to', '::']
There will be chance that number of pattern will be increased. So, is this possible ?
Note: There is no space between words.
replace("xx", " xx ")to insert the spaces before the final split on " ". If the string ends with a delimiter, as your example is, you'll have to only insert the space behind it (or remove the resulting element at the end of the array afterwards).