fmidev / fmi-avi-messageconverter-tac

Conversion module for aviation TAC messages
MIT License
1 stars 4 forks source link

Rework Latitude and Longitude regex matching #154

Open kasarit opened 11 months ago

kasarit commented 11 months ago

This issue applies to both Latitude and Longitude classes.

super("^(?<latitude>[NS]\\d+)$", prio);

The named group is obsolete, as it matches the whole regex. I'd suggest to either

It also may be wise to be strict with number of digits, e.g. "^([NS])(\\d{3})(\\d{2})?$" as this is what the EU 373 + 1338 and ICAO Annex 3 say. And we cannot be certain of the correct interpretation if number of digits mismatch - it may be better to raise a syntax error.

_Originally posted by @petringo in https://github.com/fmidev/fmi-avi-messageconverter-tac/pull/117#discussion_r989994665_