Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-07-2006, 11:34 AM   PM User | #1
SeeIT Solutions
Regular Coder

 
Join Date: May 2005
Posts: 563
Thanks: 0
Thanked 3 Times in 3 Posts
SeeIT Solutions is on a distinguished road
eregi_replace pattern

I'm trying to change a body tag from a string of html from whatever it is to <body>.

I tried:
PHP Code:
$dataHtml eregi_replace("'<body[^>]*?>',","<body>",$dataHtml); 
Any help would be appreciated.
__________________
Design Portfolio
SeeIT Solutions is offline   Reply With Quote
Old 02-07-2006, 01:51 PM   PM User | #2
NancyJ
Senior Coder

 
NancyJ's Avatar
 
Join Date: Feb 2005
Location: Bradford, UK
Posts: 3,162
Thanks: 19
Thanked 65 Times in 64 Posts
NancyJ will become famous soon enough
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?
__________________
http://www.hazelryan.co.uk
NancyJ is offline   Reply With Quote
Old 02-07-2006, 02:40 PM   PM User | #3
marek_mar
Sensei


 
Join Date: Aug 2003
Location: One step ahead of you.
Posts: 2,815
Thanks: 0
Thanked 3 Times in 3 Posts
marek_mar is on a distinguished road
PHP Code:
$dataHtml preg_replace('/<body[^>]*>/''<body>'$dataHtml); 
__________________
I'm not sure if this was any help, but I hope it didn't make you stupider.

Experience is something you get just after you really need it.
PHP Installation Guide Feedback welcome.
marek_mar is offline   Reply With Quote
Old 02-08-2006, 05:04 AM   PM User | #4
fci
Senior Coder

 
Join Date: Aug 2004
Location: Twin Cities
Posts: 1,345
Thanks: 0
Thanked 0 Times in 0 Posts
fci is an unknown quantity at this point
only change I'd suggest is to make it case insensitive:
Code:
$dataHtml = preg_replace('/<body[^>]*>/i', '<body>', $dataHtml);
fci is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 AM.


Advertisement
Log in to turn off these ads.