Use \z instead of $ for matching extension.