Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Java 8

"
(?<=watch\?v=|/videos/|embed\/|youtu.be\/|\/v\/|\/e\/|watch\?v%3D|watch\?feature=player_embedded&v=|%2Fvideos%2F|embed%2F|youtu.be%2F|%2Fv%2F|shorts\/|live\/)[^#\&\?\n]*
"
gm

Description

Gets the ID of a YouTube Video from any link to it.

Submitted by cheeseburger - 6 months ago