Regular Expressions 101

Community Patterns

YouTube Channel Username and ID

0

Regular Expression
ECMAScript (JavaScript)

/
^(?:https?:\/\/)?(?:(?:www|gaming)\.)?youtube\.com\/(?:channel\/|(?:user\/)?)([a-z\-_0-9]+)\/?(?:[\?#]?.*)
/
i

Description

Extract the Channel Username or Channel ID given a YouTube Channel URL.

Submitted by cris_hitech - 7 years ago