I am tying to retrive the last part of an path . I have an path value
/var/local/<b>india/aaa.php</b>-who is this
I need to retrive the aaa.php-who is this
using php regex.
I am tying to retrive the last part of an path . I have an path value
/var/local/<b>india/aaa.php</b>-who is this
I need to retrive the aaa.php-who is this
using php regex.
Code : (FIXED)
$pattern = '/<b>[a-z\/\.\-]+\/([a-z\.\-]+)<\/b>(.+)/i';
preg_match($pattern, $path, $matches);
$result = $matches[1].$matches[2];
echo $result;
Output : (FIXED)
aaa.php-who is this
Another approach : ('shorter', with the same result)
$path = str_replace("</b>","",$path);
preg_match('/.+\/(.+)/i', $path, $matches);
$result = $matches[1];