I once used the wonderful perl module [Regexp::Assemble](https://metacpan.org/pod/Regexp::Assemble) to produce a regexp to match [every single suburb/town name in Australia](https://gist.githubusercontent.com/singingfish/d43c884fbac00...) from a csv file download from the post office website. It was blazingly fast ... considering (better than the recdescent parser I'd been previously experimenting with).
Here's the code that generated the regex:
use Regexp::Assemble;
my $ra = Regexp::Assemble->new;
while (<$FH>) {
$csv->parse($_);
next if $. == 1;
my @fields = $csv->fields;
$ra->add($fields[1]);
}
my $suburbs = $ra->as_string;