Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Realbasic > Re: Modifying a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 7 Topic 3313 of 3326
Post > Topic >>

Re: Modifying all URLs in a string

by "Rick Rothstein \(MVP - VB\)" <rick.newsNO.SPAM@[EMAIL PROTECTED] May 19, 2008 at 02:59 AM

Here is a non-RegEx solution (assuming the text between the 
"http://www.amazon.com"
part and the product number part is always 
"/exec/ASIN/")....

Dim oldURL As String
Dim newURL As String
Dim Parts() As String
oldURL = "http://www.amazon.com/exec/obidos/ASIN/B0013EF17O/ref=br_n..."
Parts = Split(Replace(oldURL, "http://",
""), "/")
ReDim Parts(4)
newURL = "http://"
+ Join(Parts, "/") + "/**myaffiliatecodehere**/"

Rick


"Allan Drake" <supercool@[EMAIL PROTECTED]
> wrote in message 
news:24e71f53-a62e-45f5-92bc-7787c0b837a1@[EMAIL PROTECTED]
 May 9, 12:46 am, John <jmrukk...@[EMAIL PROTECTED]
> wrote:
> Allan Drake wrote:
> > I am modifying URLs for amazon products in a string along with other
> > html data in a real basic script. I can't find the right way to do it.
>
> > An Example URL:
>
>http://www.amazon.com/exec/obidos/ASIN/B0013EF17O/ref=br_nf_0_4?pf_rd...
>
> > After "/ASIN/B0013EF17O/" I want to insert my standard amazon
> > affiliate code so it would be like....
>
> > /ASIN/B0013EF170/**myaffiliatecodehere***/ <---> chop off the rest
> > of the URL
>
> > So I am basically, searching, inserting my code in the right spot, and
> > then chopping off part of the URL. I need to do this for every link in
> > my string.
>
> How about using a regular expression with a search pattern of
> (http://www.amazon.com/exec/obidos/ASIN/.+?/)
and an output pattern of
> $1***myaffiliatecodehere***/
>
> That should do the trick.
>
> Good luck -- John



Thanks for the regex syntax. Do you have a full example? I havent used
Regex before, cant find much. I'm a little bit farther, but not all
the way.
 




 7 Posts in Topic:
Modifying all URLs in a string
Allan Drake <supercool  2008-05-08 07:09:52 
Re: Modifying all URLs in a string
Allan Drake <supercool  2008-05-08 07:12:27 
Re: Modifying all URLs in a string
"Auric__" <n  2008-05-08 16:18:25 
Re: Modifying all URLs in a string
John <jmrukkers@[EMAIL  2008-05-09 06:46:19 
Re: Modifying all URLs in a string
Allan Drake <supercool  2008-05-12 14:43:49 
Re: Modifying all URLs in a string
"Rick Rothstein \(MV  2008-05-19 02:59:36 
Re: Modifying all URLs in a string
"Rick Rothstein \(MV  2008-05-19 03:02:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:26:08 CDT 2008.