View Full Version : eregi_replace pattern

SeeIT Solutions
02-07-2006, 11:34 AM
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, 01: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, 02:40 PM
$dataHtml = preg_replace('/<body[^>]*>/', '<body>', $dataHtml);

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

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