This question is nearly identicle to : http://stackoverflow.com/questions/2305362/php-search-string-with-wildcards, but will be arranged a little differently. I had a hard time understanding the proposed solutions to make my own out of them . Maybe you guys can help?
I have a start string and an end string which I use to sandwich strings of interest.
This is the function I'm currently using for this:
function get_string_between($string, $start, $end)
{
$string = " ".$string;
$ini = strpos($string,$start);
if ($ini == 0) return "";
$ini += strlen($start);
$len = strpos($string,$end,$ini) - $ini;
return substr($string,$ini,$len);
}
Sometimes my beginning strings need to have wildcards in them to account for a dynamic part of a template
for example I would need this to be my begin code variable:
$begin_code = "id='%wildcard%' class='sailors_assistant_%wildcard%'>";
and edit my original function above to detect %wildcard%(s) and account for them when using their sandwich search-n-grabs.
Any advise?