A regular expression to extract the filename from a given path. This is called filename extraction, and quite simply, it is extracting an element that matches a pattern from a string.
/[ \w-]+\./g
Matches:
- /path/to/regex.pattern
- \path\to\regex.pattern
- \\path\to\regex.pattern
- https://regexpattern.com/
Non-matches:
- regex-pattern
- regex pattern
- regexpattern
See Also:
- Regular Expression To Match Valid Filename
- Regex To Check If Are Allowed File Types
- Regular Expression To Extract File Extension From String
- Regex To Extract Domain Name From URL
- Regex To Extract Filename & Domain Name From URL
- Windows File Path Regular Expression
- Linux File Path Regular Expression
- Regex To Match Everything Before The Last Dot