A regular expression that matches everything after the last slash in a string (like a URL or a file/folder path).
Can be useful in finding out file names or query strings in a URL.
/[^/]+$/g
Matches:
- https://regexpattern.com/index.html
- https://regexpattern.com/index.html?key=value
- /path/to/regex
Non-matches:
- https://regexpattern.com/index.html/
- /path/to/regex/
See Also:
- Regular Expression To Match All URLs In Text
- URL Slug Regular Expression
- Regular Expression To Match Forward Slash
- Regex To Match The First Word After A Specific Word
- Regex To Matche A Slash At The End Of A String