/a{1,5}/; # match 1-5 'a's prefer the longest. /a{1,5}?/; # match 1-5 'a's prefer the shortest.