0

What is regex to search and validate AIS NMEA sentences?

panoet
  • 3,608
  • 1
  • 16
  • 27

1 Answers1

0

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.

panoet
  • 3,608
  • 1
  • 16
  • 27