Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created May 24, 2022 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/5befb9cc1041647e87ce6ec8d025df70 to your computer and use it in GitHub Desktop.
Save lgolubyev/5befb9cc1041647e87ce6ec8d025df70 to your computer and use it in GitHub Desktop.
var address = "One Infinite Loop, Cupertino 95014";
var cityZipCodeRegex = new Regex(@"/ ^[^,\\] +[,\\\s] + (.+?)\s * (\d{ 5 })?$/").Matches(address);
var city = cityZipCodeRegex[0].Value;
var zipCode = cityZipCodeRegex[1].Value;
saveCityZipCode(city, zipCode);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment