use Regex::PreSuf; my $re = presuf(qw( abc1 abc2 abc3 xyz1 xyz xy1 nota url )); print "$re\n"; __END__ (?:abc[123]|nota|url|xy(?:z1|[1z]))