How do I count numbers in a sentence with a global pattern?
- Regex Pattern
- \d+
- Test String
- Order 42 and 7
- Flags
- g
- Set Regex Pattern to \d+, Test String to Order 42 and 7, and Flags to g.
- \d+ matches one or more digits; scanning finds 42 at index 6 and 7 at index 13, giving Match Count 2 and Matched Texts 42, 7.
- Match Count
- 2
- Matched Texts
- 42, 7
Each run of digits is one match; decimals or signs would need a different pattern. The 100-match cap applies to longer text.
