Using rex to delete everything in the url after the & ampersand

Post Reply
gerry.odea
Posts: 96
Joined: Fri Sep 19, 2008 9:33 am

Using rex to delete everything in the url after the & ampersand

Post by gerry.odea »

I have a urls like these:
https://www.youtube.com/watch/?v=XuTwtO ... ng_pref=de ret=XuTwtOo88r8
https://www.youtube.com/watch/?v=XuTwtOo88r8
https://www.youtube.com/watch/XuTwtOo88r8

I'm using this:
<sandr "https://www.youtube.com/watch/\?v\=" "" $ShowURL>
<sandr "https://www.youtube.com/watch/" "" $ret>

but i need to remove all of the url after the &,
&cc_load_policy=1&cc_lang_pref=de ret=XuTwtOo88r8
I assume I need a rex for the last part but I'm unsure how to write it.

I tried <rex ">>[^&;]*" $ret> but it doesn't work.
Can you please advise me. Thanks
User avatar
mark
Site Admin
Posts: 5495
Joined: Tue Apr 25, 2000 6:56 pm

Using rex to delete everything in the url after the & ampersand

Post by mark »

Either of these should get you there. (assuming you want to treat ; the same as &)

<sandr ">>=[^&;]\P+>>[&;]=.*" "" $ret>

<rex ">>=[^&;]+" $ret>
Post Reply