On Tue, Apr 22, 2014 at 5:05 PM, Paul Makepeace <pa...@paulm.com> wrote:
> If your goal is to simply identify overlaps rather than generate > encompassing regexes, you could try attacking it with > intelligently/heuristically generated random numbers. > > Paul > Its just about possible to brute force the problem, on my box (~2.4GHz intel) my $count = 0; foreach my $x (1..5000000000) { if ($x =~ /^246[2-9]\d{6}$/ and $x =~ /^246(?:(?:2[346]|45|82)\d|25[0-4])\d{4}$/ ) { $count++; } } print "$count\n"; takes about 14 minutes to run, it would be easy enough to parallelise the search with threads determine the minimum and maximum numbers that could match. I guess you could get the runtime down to a minute or less. Depends on how many regexes you have to evaluate