diff --git a/src/files/get_file_extension.ts b/src/files/get_file_extension.ts index 2aee02e..52e7921 100644 --- a/src/files/get_file_extension.ts +++ b/src/files/get_file_extension.ts @@ -1,8 +1,8 @@ /** - * This function takes in a path to a file and returns the file extension. + * This function takes in a path to a file and returns the file extension (without the `.`). * @param path The path to the file * @returns The file extension */ export function getFileExtension(path : string) : string { - return path.replace(/^.*?((?:\.\w+)+)$/, (_, extension) => extension); + return path.replace(/.+\.([^/.]+$)/, (_, extension) => extension); }