Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework Latitude and Longitude regex matching #154

Open
kasarit opened this issue Sep 26, 2023 · 0 comments
Open

Rework Latitude and Longitude regex matching #154

kasarit opened this issue Sep 26, 2023 · 0 comments
Labels
sigmet/airmet SIGMET/AIRMET issues

Comments

@kasarit
Copy link
Contributor

kasarit commented Sep 26, 2023

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

  • split the expression to proper groups, e.g. "^([NS])(\\d{1,3})(\\d*)$" (with or without names) and read only groups, or
  • have a simple regex "^[NS]\\d+"$ and read characters/substrings at know indices.

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 #117 (comment)

@kasarit kasarit added the sigmet/airmet SIGMET/AIRMET issues label Sep 26, 2023
@kasarit kasarit changed the title Rework Latitude regex matching Rework Latitude and Longitude regex matching Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sigmet/airmet SIGMET/AIRMET issues
Projects
None yet
Development

No branches or pull requests

1 participant