preg_replace help
Posted: Sat Oct 29, 2005 5:02 am
Jcart | Please use
I am trying to replace:
main.php?subaction=showcomments&id=1234153463&archive=&start_from=&ucat=&page=contentte.php
with just the 1234153463 from id=1234153463
I want it to go through the entire body of the page and do this.
I have been trying to learn how to use preg_replace, but there are so many different ways that im pretty confused.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I have been trying to replace this, but just cant get it.Code: Select all
<?php
echo preg_replace("/main.php?subaction=showcomments&id\=(.*?)\&archive=&start_from=&ucat=&page=contentte.php/",
"\\1",
$body);
?>I am trying to replace:
main.php?subaction=showcomments&id=1234153463&archive=&start_from=&ucat=&page=contentte.php
with just the 1234153463 from id=1234153463
I want it to go through the entire body of the page and do this.
I have been trying to learn how to use preg_replace, but there are so many different ways that im pretty confused.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]