I want to check if the contents of $url
contain v=
anywhere after https://youtube.com/watch?
.
Example output (take note of the present and missing instances of v=
):
> https://youtube.com/watch?list=PL3O9DAQHAxSTXqOH5VV6DO0BBupZ4feqz&v=apdJBcDF6vA&index=2
URL allowed.
> https://youtube.com/watch?list=PL3O9DAQHAxSTXqOH5VV6DO0BBupZ4feqz&index=2
URL NOT allowed.
> https://youtube.com/watch?v=apdJBcDF6vA
URL allowed.
> https://youtube.com/v=apdJBcDF6vA
URL NOT allowed.
> https://youtube.com/watch?v=apdJBcDF6vA&list=PL3O9DAQHAxSTXqOH5VV6DO0BBupZ4feqz&index=2
URL allowed.
> https://youtube.com/watch?v=apdJBcDF6vA&list=PL3O9DAQHAxSTXqOH5VV6DO0BBupZ4feqz
URL allowed.
> https://youv=tube.com/watch?v=apdJBcDF6vA
URL NOT allowed.
> v=https://youtube.com/watch?v=apdJBcDF6vA
URL NOT allowed.
I would try some code to test, but I honestly am not sure what to use.
OS is macOS High Sierra 10.13.6 and bash
version is 3.2.57(1)-release