Jump to content

Recommended Posts

I'm a guy so you must feel pretty gay right now.

 

Anyway. Question is: does anyone have some sort of regex solution for validating Youtube URLs? Not the embed code, just the URL of the video.

 

I reckon this is the kind of pattern that it must match. I'm hopeless at regex so I'd be very grateful if someone could help?

 

http://(country-specific-subdomain).youtube.com?(GET variables)

Link to comment
https://forums.phpfreaks.com/topic/153630-help-and-ill-post-boobs/
Share on other sites

well, you could do this:

 

~http://[^\.]*\.youtube\.com.*~

 

that would validate http://[anythinghere].youtube.com[anythingafter]

 

If you have a list of specific subdomains you want to allow, you could do

 

~http://(a|b|c)\.youtube\.com.*~

 

where a b c is replaced by the specific subdomains (list all allowed ones in there, separating them with the pipe)

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.