Hello,
i have a little problem with string and html tags ...
I need to split a string by any html tag and get the textparts without the tags but separated by parts
so for example:
3 parts =
"lorem<br>ispum<li><strong>dolor</strong></li>";
so 1 = lorem ; 2= ipsum; 3 = dolor;
or "lorem<br>ipsum<br>dolor"; = also 3 parts like above
at this point i get all but not the br Tags
$fieldCounter = 0; // counter für feldanzahl
$fieldCounter2 = 0; // counter für zerstückelung
foreach( $resNew as $k4 =>$v4 ){
$fieldCounter ++;
echo '<br><br>fieldcounter: ';echo $fieldCounter; echo '<br>String: '; echo $v4; echo '<br>';
// with preg_match_all string split with tags
// regex for html tags -> anything but not br br // maybe all single tags
// $html_regex1 = '|<[^>]+>(.*)</[^>]+>|U';
$html_regex1 = '|<[^>]+>(.*)</[^>]+>|U';
$vorkommen = preg_match_all( $html_regex1,$v4, $ar_treffer, PREG_PATTERN_ORDER );
echo 'treffer: '; echo $vorkommen; echo '<br>';
echo 'sizeof artreffer '; echo sizeof($ar_treffer[1]); echo '<br>';
for ($i = 0; $i < sizeof($ar_treffer[0]); $i++){
echo '<br>artreffer[0][i]: '; echo $partString = strip_tags($ar_treffer[0][$i]);echo '<br>';
$fieldCounter2 ++;
echo 'fieldcounter2 : '; echo $fieldCounter2;
}
}
i hope somebody have an idea for my problem
in these string could be no html or only br s and a mix off all
thanks for ur help