m[(\d{4,5})\.htm] and print $1 for qw[ xxx1234.htm xxxx12345.htm ];; 1234 12345