waynew Posted April 11, 2009 Share Posted April 11, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/153630-help-and-ill-post-boobs/ Share on other sites More sharing options...
.josh Posted April 11, 2009 Share Posted April 11, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/153630-help-and-ill-post-boobs/#findComment-807282 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.