Hello Friends,
Please help me in bellow, I wanted to scrap zip code from below address
Kath Smith
317 County Rd
Torrington, CT 06790-4206
Need OUTPUT: 06790
I want only 06790 in variable
Hello Friends,
Please help me in bellow, I wanted to scrap zip code from below address
Kath Smith
317 County Rd
Torrington, CT 06790-4206
Need OUTPUT: 06790
I want only 06790 in variable
Hi @Bot_Learner
How about the Regular expression?
System.Text.RegularExpressions.Regex.Match(YourString,"\d.*(?=\D\b\d{4}\b)").Tostring
Regards
Gokul
RegEx
(?<!\d)\d{5}(?!\d)
Try using this regular expression \D(\d{5})\D
System.Text.RegularExpressions.Regex.Match(YourString,"\D(\d{5})\D").Tostring
Thanks all @Gokul001 @postwick @aquinn @raja.arslankhan @Parvathy for reply …could you plz let me know…how can i extract state name…like CT in above example…everytime time i have different sate of 2 letters only.
Google is your friend on these things.
https://www.google.com/search?q=regex+to+get+2+letter+state+from+address
Hi @Bot_Learner
Use this regex to scrap state name
System.Text.RegularExpressions.Regex.Match(inputString, “(?<=\b)[A-Z]{2}(?=\s\d)”).Value
Thanks!!
You can do that as long as the address is always formatted exactly the same.
check this post
looks related for your request
Regards