For some reason my regex is matching what I am after and extra. I am needing to just match the group #
, but it's matching the first number of the phone numbers also.
Example data:
id: N group: 1 category: NAMES : Mike
id: N group: 2 category: NAMES : Seth
id: # group: 1 category: PHONE : 123-456-789
id: # group: 2 category: PHONE : 111 111-1111
id: @ group: 1 category: EMAIL : mike@mail.com
id: @ group: 2 category: EMAIL : seth@yahoo.com
Regex
preg_match_all('/:\s+\d/', $data, $matches);
Current output
1
2
1
1
2
1
1
2
Expected output
1
2
1
2
1
2