May-10-2021, 08:37 PM
.*
is greedy, and will consume as much as it can. If there's multiple newlines after GPGGA, then only the last would match the regex, and all the intermediates would show in your results (as you're seeing).So you can either...
1) replace the .* with a character group that matches everything except a newline:
GPGGA,([^\r\n]+)\r\n
, or2) add a non-greedy modifier to it:
GPGGA,(.*?)\r\n