Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 YouTube profile ID regex
Zenk Offline
Junior Member
**
Posts: 27
Joined: Nov 2011
Post: #1
YouTube profile ID regex
Hi guys, could you help me sort out the YouTube IDs?
Unfortunately YouTube now offers custom IDs to people with 500 min. subscribers only, so I am forced to allow the long weird URLs on my forum as well.

At the moment I have this regex:

PHP Code:
((http|https):\/\/|)(www\.)?youtube\.com\/(channel\/|user\/)[a-zA-Z0-9]{1,}


Which allows - http/https +/ www:

Code:
youtube.com/channel/CoolUserName
youtube.com/user/CoolUserName
youtube.com/channel/xHsadRaNdOmLeTtErS_3-x
youtube.com/user/xHsadRaNdOmLeTtErS_3-x


But it would be amazing if someone could help me with doing it so that you can just enter the ID as well, eg:
http/https and/or www:

PHP Code:
1
2
3
4
5
6
7
youtube.com/user/CoolUserName - value 2
youtube.com/channel/CoolUserName - value 2
youtube.com/CoolUserName - value 2*
CoolUserName - value 1
youtube.com/user/xHsadRaNdOmLeTtErS_3-x - value 2
youtube.com/channel/xHsadRaNdOmLeTtErS_3-x - value 2
xHsadRaNdOmLeTtErS_3-x - value 1


*youtube.com/CoolUserName - optional.

So the display format would be: {VALUE$1}{VALUE$2}

Unless there is a way to just store the ID (value 1) from the entered URL into the database?

12-27-2014 09:48 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
YouTube profile ID regex - Zenk - 12-27-2014 09:48 AM
RE: YouTube profile ID regex - ZiNgA BuRgA - 12-27-2014, 10:38 AM
RE: YouTube profile ID regex - Zenk - 12-27-2014, 11:10 AM
RE: YouTube profile ID regex - ZiNgA BuRgA - 12-27-2014, 05:00 PM
RE: YouTube profile ID regex - Zenk - 12-27-2014, 07:17 PM
RE: YouTube profile ID regex - ZiNgA BuRgA - 12-28-2014, 02:59 PM

 Standard Tools
Forum Jump: