while (my @match = $text =~ m/(APCs?)(?:(?:\s|,|and)+(\d{3}))+/xgc) { push @extracts, @match; }