Scala - Youtube video id from URL
===

I have the following regex from here: http://stackoverflow.com/a/10405818/924999

    val regex = """/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/ig;""".r

I'm attempting to extract the video ID from youtube video urls with:

    val url = "http://www.youtube.com/watch?v=XrivBjlv6Mw"

    url match {
		
        case regex(result) => result
			
        case _ => null
		
    }

However it seems to always return null, is there something I'm missing or need to do differently?

Thanks in advance for any help, much appreciated :)

     