Created
November 3, 2022 18:23
-
-
Save aaryan79831014/85fe9ada49255e537a4ea34987e3d8de to your computer and use it in GitHub Desktop.
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
void Main() | |
{ | |
string pattern = @"^(AB|DD|DG|EH|FK|G|HS|IV|KA|KW|KY|ML|PA|PH|TD|ZE)\d{1,2}\s?(\d[\w]{2})"; | |
string postcode = "AB6 5DD"; | |
Match match = Regex.Match(postcode, pattern, RegexOptions.IgnoreCase); | |
if (match.Success) | |
{ | |
"Scotland".Dump(); | |
} | |
else | |
{ | |
"England".Dump(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment