#! /usr/local/bin/perl -w use Regexp::Assemble; my $re = Regexp::Assemble->new->add( 10..374, 376..379, 382..385, 388..499, 530..534, 541..543, 618, 619, 700..704, 707..709 ); % ./ra (?:3(?:7[012346789]?|8[234589]?|0\d?|1\d?|2\d?|3\d?|4\d?|5\d?|6\d?|9\d?)|1(?:0\d?|1\d?|2\d?|3\d?|4\d?|5\d?|6\d?|7\d?|8\d?|9\d?)|2(?:0\d?|1\d?|2\d?|3\d?|4\d?|5\d?|6\d?|7\d?|8\d?|9\d?)|4(?:0\d?|1\d?|2\d?|3\d?|4\d?|5\d?|6\d?|7\d?|8\d?|9\d?)|5(?:[01256789]|3[01234]?|4[123]?)|7(?:[123456789]|0[01234789]?)|6(?:[023456789]|1[89]?)|8\d|9\d) % ./ra | wc -c 335