3 ms·
I've been looking for tools that would help me do this. Are there any interesting datasets that you have converted to regexes with this? Zipcodes would be some
by captn3m0 11y ago
I've been looking for tools that would help me do this. Are there any interesting datasets that you have converted to regexes with this?
Zipcodes would be something I'd like to see available as regexes.
- aaronem 11y agoI can't load the site, so I'm not sure exactly what it's offering, but I'm also not sure what you mean by a regex for zipcodes. Surely it'd be simpler, quicker, and more maintainable just to match /(\d{5})/ and filter out invalid codes after the fact? (Edit: If you want the full ZIP+4 where it's given, you can add (\-\d{4})? as a term in the regex, and you can validate them the same way. USPS also offers an API for validating address information; it's been some years since I used it, and I recall it being somewhat recondite in the fashion of most .gov APIs, but it's there and it works.) Edit again: OK, the site loaded. It looks like a tool for generating regexes via machine learning techniques to match highly complex targets. From a purely technical perspective, that sounds really neat -- but from a maintainability perspective, it sounds like even more of a nightmare than complex regexes usually are.
- atomwaffel 11y agoThe GeoNames Country Information table has a "Postal Code Regex" column that you might find interesting: http://download.geonames.org/export/dump/countryInfo.txt http://download.geonames.org/export/dump/countryInfo.txt
- aaronem 11y agoSome of those regexes are terrifying. Granted that I'm not sure there is any better alternative for extracting structured address information from an unstructured source, but...