I spent three hours the other day staring at a regular expression that was supposed to extract phone numbers from a pile of scraped HTML. It worked for 70% of the cases, then failed spectacularly on the rest. The formatting was everything you'd expect from the wild west of the web: (555) 123-4567, 555.123.4567, 5551234567, and the ever-popular call me at 555-123-4567 after 5.
Sound familiar? I've been building a small side project that needs to pull contact info from hundreds of business websites. I thought regex would be enough. I was wrong.
What I tried that didn't work
Regex-only approach
I started with the classic regex patterns from Stack Overflow. Something like:






