Hi!
I need to use preg_reg on some string with content from a html file.
$file = file_get_contents($path);
$html_array = explode(' ', $file);
The problem is that the array looks sometimes like this:
[77]=> string(35) "<div> </div> <br> {{testto}} <br>"
I have tried to put in some whitespaces there.. :P Won't work.. :/ Later on I will do a preg_grep like this:
$childframes = preg_grep('!\{\{(\w+)\}\}!', $html_array);
$retur = array();
foreach($childframes as $v){
$v = trim($v);
$retur[] = substr($v, 2, -2);
}
return $retur;
So the idea is basicly to get {{testto}} in a array, every ocurrence of {{sometext}} where I substring it down to only 'sometext'.
Thanks =)
EDIT: To repeat the problem: explode is not working right so I need some regex if possible, instead of just whitespace.., and is there any better way to do preg_grep on on a large string?