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

Screenshot 2024-09-24 at 10.40.11 AM.png

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:

Screenshot 2024-09-24 at 10.53.31 AM.png
bottom of page