The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
amazon link regex help
Hi guys,
I'm trying to replace a normal amazon.de Link oder any amazon.de Link with a affiliate ID to my own: http://www.amazon.de/exec/obidos/ASI...904298-7328563 --> http://www.amazon.de/exec/obidos/ASI...G/chemieonline I wrote a function for it but have some probs. There must be a whitespace at the endling of the string. otherwise if the url is the last thing in the string it won't work... I added an extra whitespace at the end in the funktion. Also if the link ends like http://www.amazon.de/exec/obidos/ASI...904298-7328563[ /url ] the [ /url ] get cut of... Need a little help as I'm not that regex guy: PHP Code:
|
#2
|
|||
|
|||
When using backtracking, you want the $2 to be passed to regex engine. Though, normally php will evaluate it.
So, to ensure it's passed as a dollar sign and not as an evaluated variable you need to add a slash before it. Like so... Code:
preg_replace("/(http:\/\/|http:\/\/www.|www.|)amazon.de\/exec\/obidos\/ASIN\/([A-Z0-9]+)([^\"\n]*?)\s+/i","http://www.amazon.de/exec/obidos/ASIN/\$2/$id ",$string); Modin |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|