Page 1 of 1

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

Posted: Wed Nov 11, 2020 4:46 pm
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

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

Posted: Wed Nov 11, 2020 5:57 pm
by mark
Either of these should get you there. (assuming you want to treat ; the same as &)

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

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