I want to find string between first and last underscore (_
) from the below string
I have tried this:
$s = '23_The_Sample_Book_145236985.pdf';
$matches = [];
$t = preg_match('/\_(.*?)\_/', $s, $matches);
print_r($matches[1]);
I want to get output like ...
The_Sample_Book
But i get like...
The