use path.extname instead of regExp