4 sty 2013

Usunięcie tagów html z tekstu

Usunięcie tagów html z tekstu

$art_text = preg_replace("/(align|class|style|clear)\=\"([^\"]*)\"/", '', $art_text);
$art_text = strip_tags($art_text, '<p><br><strong><b><em><u><strike>');
echo $art_text;
4 sty 2013

Wyrażenie regularne i preg_match

$test='http://kody.wig.pl/strony-stare-2006_11-all.html';
$test='http://kody.wig.pl/strony-nowe-2012_11-1233.html';
echo $test;
preg_match("/(-(?P([0-9]+|all)))?\.html$/", $test, $back);
print_r($back);