Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safer regex to match yt links #14

Closed
wants to merge 1 commit into from
Closed

Conversation

Fusselwurm
Copy link

After the last update, this plugin started to match all sorts of URLs.

I propose a more restrictive regex:

regex meaning
/<a href="http
s? https is optional
:\/\/ end scheme, start domain part of URL
(?:[^\/]+\.)? optional sub domains, non-matching group
`(?:youtube.com youtu.be)`
\/ start path
(?:watch)? optional group
(?:\?v=)? forward to v=, if it exists
([A-Za-z0-9]+) get the video id
[^"]*"[^<]*<\/a>/g rest of the html href attribute, end of href attribute closing tag

@Fusselwurm
Copy link
Author

(scratch that, its still retarded)

@Fusselwurm Fusselwurm closed this Aug 7, 2015
@Fusselwurm
Copy link
Author

@Fusselwurm Fusselwurm deleted the patch-1 branch August 7, 2015 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant