View Full Version : eregi_replace pattern

SeeIT Solutions
02-07-2006, 12:34 PM
I'm trying to change a body tag from a string of html from whatever it is to <body>.

I tried:

$dataHtml = eregi_replace("'<body[^>]*?>',","<body>",$dataHtml);

Any help would be appreciated.

02-07-2006, 02:51 PM
I'm a bit confused about what you're trying to do here. isnt <body> a body tag?
What exactly are you trying to accomplish?

02-07-2006, 03:40 PM
$dataHtml = preg_replace('/<body[^>]*>/', '<body>', $dataHtml);

02-08-2006, 06:04 AM
only change I'd suggest is to make it case insensitive:

$dataHtml = preg_replace('/<body[^>]*>/i', '<body>', $dataHtml);