top of page
Regex
Week 2
For this exercise, I tried to write a regular expression to detect US addresses from a set of data.
​
I first generated a set of fake data using chatGPT

I used the https://regex101.com/ site to try out different variations to write a regex that detected US addresses (written in the standard format)
​
Regex -> [^-\d{3,4}]\d{3,4}\s[A-Z][a-z].*\s(St),\s[A-Z][a-z].*,\s[A-Z]{2}\s\d{5}
​
​
Results:

bottom of page