I have a URL like below:
http://abc.def.com/gh-tqa/name-of-the-file/ZW607CCF.html
Now I want to get the string of ZW607CCF
without .html
.
How can I achieve this using PHP?
I have a URL like below:
http://abc.def.com/gh-tqa/name-of-the-file/ZW607CCF.html
Now I want to get the string of ZW607CCF
without .html
.
How can I achieve this using PHP?
You don't need a regex here. Just use pathinfo()
:
$url = 'http://abc.def.com/gh-tqa/name-of-the-file/ZW607CCF.html';
$filename = pathinfo($url, PATHINFO_FILENAME);