So I have a scenario where I need to extract out all numbers from this string, now the problem that I am encountering is that there could be white-spaces between the commas or the actual number themselves. How can I write a generic regex
to extract out only numbers. My current scenario looks like:
Test strings:
<classifier id="box-geometry" value="476,736,703,997" />
<classifier id="box-geometry" value="476,736,703, 997" />
<classifier id="box-geometry" value="476, 736, 703, 997" />
Attempted regex: value="(\d+),(\d+),(\d+),(\d+)"
Example: https://regex101.com/r/se0dwk/1/
As you can see, only the first string matches for all the numbers in their respective capturing groups.
Any help would be appreciated.
Thanks!