I've read through the RegEx mastery article, which has been very helpful, bit I've hit a wall. I'm trying to get quantities out of a text string, and it works for some entries, but not all. Particularly, where it doesn't work, it truncates the leading number. Can someone make a recommendation on where I'm going wrong with the parse and how I can correct for it?
Parse showing $1 in the first condition, and $2 in the second
(^\d+)|(^.*\s*)(\d+)
Data
| String to parse | Desired outcome | Actual outcome |
| 24 sets per case | 24 | 24 |
| 6CS | 6 | 6 |
| Widgets 1/CS | 1 | 1 |
| Many Widgets 20/CS | 20 | 0 |
| Few Widgets -20/Case | 20 | 0 |