Last active
November 6, 2023 22:25
-
-
Save JoshuaCarroll/f6b2c64992dfe23feed49a117f5d1a43 to your computer and use it in GitHub Desktop.
Regular expression (regex) for non-US amateur radio call signs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
All amateur radio call signs: | |
[a-zA-Z0-9]{1,3}[0-9][a-zA-Z0-9]{0,3}[a-zA-Z] | |
Non-US call signs: | |
\b(?!K)(?!k)(?!N)(?!n)(?!W)(?!w)(?!A[A-L])(?!a[a-l])[a-zA-Z0-9][a-zA-Z0-9]?[a-zA-Z0-9]?[0-9][a-zA-Z0-9][a-zA-Z0-9]?[a-zA-Z0-9]?[a-zA-Z0-9]?\b | |
US call signs: | |
[AKNWaknw][a-zA-Z]{0,2}[0-9][a-zA-Z]{1,3} |
@JoshuaCarroll Just saw your comment. Learning Flutter and making a simple call sign lookup iOS and Android app.
Very cool! Thanks for sharing!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for providing this! I modified the expression to not match calls like: A6AA, A6AAA, AAA6A since these don't follow the U.S. rules. Also calls in the range AM* to AZ* don't get matched either.
Modified RegEx: ^[KNWknw][a-zA-Z]{0,2}[0-9][a-zA-Z]{1,3}$|^[Aa][a-lA-L]{1}[0-9][a-zA-Z]{1,2}$
This matches the whole string too. Been using this to validate U.S. callsigns in the DMR database as well as finding several malformed U.S. calls.