Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocsChangelog
Internet
#youtube
#video
#url
#embed

YouTube Video URL

Matches a YouTube video URL in both youtube.com/watch?v= and youtu.be/ formats and extracts the 11-character video ID.

✓ Video embed parsers✓ Content aggregators✓ Link preview generation
/
/
Safe
Test String
3 matches
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
hh— 'h' — literal character
tt— 't' — literal character
tt— 't' — literal character
pp— 'p' — literal character
s?s— 's' — literal character — repeated zero or one time (optional) · ? — zero or one time (optional)
::— ':' — literal character
\/\/— \/ — escaped character '/'
\/\/— \/ — escaped character '/'
(?:…)?Non-capturing group— Non-capturing group — groups without capturing (no index assigned) — repeated zero or one time (optional) · ? — zero or one time (optional)
ww— 'w' — literal character
ww— 'w' — literal character
ww— 'w' — literal character
\.\.— \. — escaped character '.'
(?:…)Non-capturing group— Non-capturing group — groups without capturing (no index assigned)
yy— 'y' — literal character
oo— 'o' — literal character
uu— 'u' — literal character
tt— 't' — literal character
uu— 'u' — literal character
bb— 'b' — literal character
ee— 'e' — literal character
\.\.— \. — escaped character '.'
cc— 'c' — literal character
oo— 'o' — literal character
mm— 'm' — literal character
\/\/— \/ — escaped character '/'
ww— 'w' — literal character
aa— 'a' — literal character
tt— 't' — literal character
cc— 'c' — literal character
hh— 'h' — literal character
\?\?— \? — escaped character '?'
vv— 'v' — literal character
==— '=' — literal character
||— | — alternation: matches expression on left OR right
yy— 'y' — literal character
oo— 'o' — literal character
uu— 'u' — literal character
tt— 't' — literal character
uu— 'u' — literal character
\.\.— \. — escaped character '.'
bb— 'b' — literal character
ee— 'e' — literal character
\/\/— \/ — escaped character '/'
(…)Group #1— Capturing group — captures matched text for reuse or extraction
[…]{11}Character class […]— Matches any single character listed in this set — repeated exactly 11 times · {11} — exactly 11 times
Pattern: 85 charsInput: 96 chars
100% client-side · private

✓ Valid Examples

  • https://www.youtube.com/watch?v=dQw4w9WgXcQ
  • youtu.be/dQw4w9WgXcQ
  • youtube.com/watch?v=dQw4w9WgXcQ

✗ Invalid Examples

  • https://vimeo.com/123456
  • https://youtube.com/
  • youtu.be/short

Usage & Integration

Validate YouTube Video URL natively in your backend or frontend without copying regex strings.

Node / Edge

import { validate } from '@regexto/validators';

validate('youtube-url', '...');

Python

from regexto_validators import validate

validate("youtube-url", "...")

Go

import "github.com/regex-to/validators-go"

valid, err := validators.Validate("youtube-url", "...")

PHP

use RegexTo\Validators\Validator;

Validator::validate('youtube-url', '...');

Rust

use regexto_validators::validate;

let is_valid = validate("youtube-url", "...").unwrap();