'aaabb' =~ /aa(b(?{print "\nYes b letter"})){0,2}/ will give nothing