Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-21-2004, 06:04 AM   #1
Veiga
Confirmed User
 
Join Date: Jun 2001
Location: Portugal
Posts: 157
Regular Expression help PREG_REPLACE()

Hello

I need to do a fast replace using preg_replace on php.

The syntax is:

Everything inside a html href tag "&" with a "#"

So, the html code:

<a href="https://gfy.com/link/blah&g">link &</a>
would go to
<a href="https://gfy.com/link/blah#g">link &</a>

Only replacing the & inside html.
thank you
__________________
Sell me your portuguese Traffic!
Euro Luso
Veiga is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-21-2004, 06:19 AM   #2
Tim Tighty
Registered User
 
Join Date: Dec 2004
Location: Scandinavia
Posts: 46
PHP Code:
<?php
$strtoreplace 
"here is a link <href=test.php?id=1&1234=2345>terst</a>;"
$search "&";
$replace "#";
$text preg_replace($search$replace$strtoreplace);
echo 
$text ;
?>
__________________

Absolute Niche Cash | Your New Exclusive Partnership Programs
Email: [email protected] | ICQ: 297872720

Last edited by Tim Tighty; 12-21-2004 at 06:21 AM..
Tim Tighty is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-21-2004, 06:20 AM   #3
Tim Tighty
Registered User
 
Join Date: Dec 2004
Location: Scandinavia
Posts: 46
should do the job allright
__________________

Absolute Niche Cash | Your New Exclusive Partnership Programs
Email: [email protected] | ICQ: 297872720
Tim Tighty is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-21-2004, 06:23 AM   #4
kaktusan
Confirmed User
 
kaktusan's Avatar
 
Industry Role:
Join Date: Mar 2003
Location: Pornblogspace.com
Posts: 334
preg_replace("\&","#","<a href=\"https://gfy.com/link/blah&g\">link &</a>");

This should work man. Try it out ;)
kaktusan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-21-2004, 09:17 AM   #5
Veiga
Confirmed User
 
Join Date: Jun 2001
Location: Portugal
Posts: 157
Yes, but I do NOT want to replace anything else than what's inside the href.
__________________
Sell me your portuguese Traffic!
Euro Luso
Veiga is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.