0

i need a regex from CNN url to match the url part for their embeded video. it should find part of URL between videos/ & /video.

it's easy with this simple regex

videos\/(.*)\/video

//www.cnn.com/videos/business/2019/12/17/dawn-powerwash-dish-spray-zw-orig.cnn-business/video/playlists/stories-worth-watching/

But some url do not have the second '/video' word.

//www.cnn.com/videos/business/2019/11/15/modern-glass-house-new-york-green-roof-orig.cnn-business

I need that part after the word video til the end

In my example here, the third one do not work because there's no the second /video/ part in the url.

EX: REGEX101

Gino
  • 1,834
  • 2
  • 19
  • 20

0 Answers0