I'm trying to create a regex to extract data from the string. My sample string: dn1:pts-sc1.1. Format of a data I expect: ['pts', 'sc', '1.1'] so basically every set of letters after : and the numbers from the end.
What i have right now:
/^[^:]+:(?:([a-z]+)-?)+([\d\.]+)$/g
Unfortunately, it returns only last set of letters.
['sc', '1.1']
I also tried to add + to the first capturing group:
/^[^:]+:(?:([a-z]+)+-?)+([\d\.]+)$/g
The result in the same. Only difference in that regex101 gives me this comment:
A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data
--edit
examples of input string:
dn2.33:sc-pts-tt-as3.43dn2.33:sc3.43dn2.33:sc-tt-as3.43
So basically I don't know the number of letter groups.