Regex to Search AIS NMEA Sentence

254 Views Asked by At

What is regex to search and validate AIS NMEA sentences?

1

There are 1 best solutions below

0
On BEST ANSWER

According to https://gpsd.gitlab.io/gpsd/AIVDM.html, a safe bet that any such sentence containing an A or B channel code in field 5 is AIVDM/AIVDO.

For now, I am using regex

[A-Z] \w+,\d,\d,(?:\d{1}|),[A-B],[^,]+,0\*([A-Za-z0-9]{2})

Hope this helps.