A regular expression to extract the filename or domain name from a given URL (after the /, before the file extension).
Can be used to get all filenames or domain names from a list of URLs.
/^.*\/|\.[^.]*$/g
Matches:
- https://regexpattern.com
- https://www.regexpattern.com
- https://www.regexpattern.com/example.jpg
- https://regexpattern.com/path/admin.php
See Also:
- Regular Expression To Match Valid Filename
- Regex To Extract Filename From A Path
- Regular Expression To Extract File Extension From String
- Regex To Extract Domain Name From URL