Regex with fixed element and list of floats
I need to create a regex which will match and group below examples:
(fdsa) 12.3,322.3, 213, 332.5
(asdf ASDF) 2.7, 3
From each of the examples I would like to get groups several groups:
1st group would be the word/words inside bracket
2nd/3rd/n-th group would be the following float/ints. Depending on the example, there might be different quantity of such groups but 1 should be minimum.
So in the end from the first example I would like to get below grouped elements:
- fdsa
- 12.3
- 322.3
- 213
- 332.5
I’m having troubles with the second part, which is getting multiple groups of float/ints. My regex so far:((.+))[ ,]*([0-9]+?[.]?[0-9]*)
However this one matches only the words inside brackets and first float/int (omits the rest of the float/ints).
Thanks for all the help!
Read more here: Source link