1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Find and Replace using RegEx in VbScript?

Discussion in 'General Scripting Chat' started by arthro, Aug 3, 2012.

  1. arthro

    arthro Regular Member

    Joined:
    Aug 18, 2008
    Messages:
    258
    Likes Received:
    13
    Hi, I please help me on using RegEx for VbScript.

    I have a text file containing urls like:

    Code:
    hxxp://www.AffiliateSite.com/productpage.php/AffiliateID/page/-/ProductID
    Now I need to replace the "AffiliateID"s with my affiliate ID, I know the basic find and replace in VbScript but how do I do it with RegEx and VbScript if the text file has VARIOUS "AffiliateID"s ?

    Please help me, I'm really not that good in RegEx. Thanks in advance.

    (Please don't suggest Notepad to find and replace manually as I have many text files that I have to find and replace those urls where each file consist of different/various affiliate ID's. I will loop it into different text files after learning how to replace using RegEx)
     
  2. kiggd

    kiggd Junior Member

    Joined:
    Apr 28, 2012
    Messages:
    116
    Likes Received:
    44
    Try:
    Code:
    /productpage.php\/(.+)\/page/i