NAME
Regexp::Pattern::YouTube - Regexp patterns related to YouTube
VERSION
This document describes version 0.004 of Regexp::Pattern::YouTube (from Perl distribution Regexp-Pattern-YouTube), released on 2020-08-21.
SYNOPSIS
use Regexp::Pattern; # exports re()
my $re = re("YouTube::video_id");
DESCRIPTION
Regexp::Pattern is a convention for organizing reusable regex patterns.
PATTERNS
video_id
YouTube video ID.
Caveats:
There's no official guarantee that the video ID will always be 11 characters, or that the allowed character set will stay the same. From Lhttps://groups.google.com/d/msg/youtube-api-gdata/maM-h-zKPZc/PJDlDWv77TEJ:
"We don't make any public guarantees about the format for video ids. While they're currently 11 character strings that contain letters, numbers and some punctuation, I wouldn't recommend hardcoding that into your application (unless you have an easy way of changing it in the future)."
This regex does not check whether a video exists. To do that, you'll need to use the YouTube API.
Examples:
Example #1.
"aNAtbYSxzuA" =~ re("YouTube::video_id", {-anchor=>1}); # matches
Incorrect length.
"aNAtbYSxzuA-" =~ re("YouTube::video_id", {-anchor=>1}); # DOESN'T MATCH
Contains invalid character.
"aNAtb+SxzuA" =~ re("YouTube::video_id", {-anchor=>1}); # DOESN'T MATCH
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Regexp-Pattern-YouTube.
SOURCE
Source repository is at https://github.com/perlancar/perl-Regexp-Pattern-YouTube.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Regexp-Pattern-YouTube
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
Some utilities related to Regexp::Pattern: App::RegexpPatternUtils, rpgrep from App::rpgrep.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020, 2018, 2016 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.