1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

need help with preg replace

Discussion in 'PHP' started by cr3at1v3, Mar 7, 2018.

  1. #1
    hi all, i wish to ask for guidance on how to do this.

    i have links below for example:
    https://r14---sn-bvvbax-hjpl.googlevideo.com/videoplayback?mn=sn-bvvbax-hjpl%2Csn
    https://r9---sn-bvvbax-hjpe.googlevideo.com/videoplayback?ipbits=0&initcwndbps=5
    https://r15---sn-bvvbax-hjpe.googlevideo.com/videoplayback?ipbits=0&initcwndbps=558750
    https://r10---sn-bvvbax-hjpe.googlevideo.com/videoplayback?dur=360.164&ratebypass

    what i want is to get rid of the random string:
    r14---sn-bvvbax-hjpl.googlevideo.com
    r9---sn-bvvbax-hjpe.googlevideo.com
    r15---sn-bvvbax-hjpe.googlevideo.com
    r10---sn-bvvbax-hjpe.googlevideo.com

    and replace with the following string:
    redirector.googlevideo.com

    hope someone could shed light, show me the proper code.

    thank you very much.
     
    cr3at1v3, Mar 7, 2018 IP
  2. cr3at1v3

    cr3at1v3 Greenhorn

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    thanks all.

    already found the solution:
    $text=preg_replace("/https:\/\/(.*)\.googlevideo\.com/", "https://redirector.googlevideo.com", $text);
    PHP:
     
    cr3at1v3, Mar 7, 2018 IP