Advertisement:

regex help please!

Aloittaja Aquilo, helmikuu 12, 2007, 07:45:11 IP

« edellinen - seuraava »

Aquilo

I have this little piece of code doing what it should as for as finding/fixing html tags, I just don't know how to get it back into my text string, could someone help?

$text = '<table cellpadding=2 cellspacing=1 width=150 border=0><tr><td colspan=2 align=center>';
preg_match_all('/<[^>]+>/s', $text, $tags, PREG_PATTERN_ORDER);
foreach (array("table","td","tr","img","a",font") as $starter)
foreach ($tags[0] as $atag)
if (preg_match('/^<\s*'.$starter.'\s*(.*)>/i',$atag,$alist))
echo preg_replace('/([^=])=(\w*)/','\1="\2"',$alist[1]), '<br />';

echo "\n\n\n", $text;


thanks!
Aquilo

Aquilo


Advertisement: