-
-
Save ix4/65967327ba0c836d0cc3731a5113dc87 to your computer and use it in GitHub Desktop.
Regular expression to find government domains for websites / email addresses
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
# regex to match government emails. Should detect: | |
# foo.gov, foo.mil | |
# foo.gov.uk, foo.mil.uk | |
# foo.fed.us | |
# foo.govt.nz, foo.gc.ca, foo.guv.ro, gub.uy | |
# note: foo.gouvt, foo.gc, foo.fed.uk, etc. will technically pass, but they are invalid domains | |
regex = /(\.g[ou]{1,2}(v|b|vt)|\.mil|\.gc|\.fed)(\.[a-z]{2})?$/i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment