Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: Aquilo - helmikuu 12, 2007, 07:45:11 IP

Otsikko: regex help please!
Kirjoitti: Aquilo - helmikuu 12, 2007, 07:45:11 IP
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
Otsikko: Re: regex help please!
Kirjoitti: Aquilo - helmikuu 12, 2007, 08:48:06 IP
got it thanks! ;D