View Single Post
Old 09-15-2009, 08:35 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,530
regex nightmare: anyone want to check it?

My youtube wordpress plugin works via

[!youtube]L1BDM1oBRJ8[/youtube!]

I also wanted to be able to do it via

https://youtube.com/watch?v=L1BDM1oBRJ8
https://youtube.com/watch?v=L1BDM1oBRJ8
www.youtube.com/watch?v=L1BDM1oBRJ8
youtube.com/watch?v=L1BDM1oBRJ8
watch?v=L1BDM1oBRJ8
v=L1BDM1oBRJ8
L1BDM1oBRJ8
https://youtube.com/v/L1BDM1oBRJ8

Code:
$regex = "/\[(?:(?:http:\/\/)?(?:www\.)?youtube\.com\/)?(?:(?:watch\?)?v=|v\/)?([a-zA-Z0-9\-\_]{11})(?:&[a-zA-Z0-9\-\_]+=[a-zA-Z0-9\-\_]+)*\]/";
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


My Cam Feeds Script / Gallery Scraper / WPXXX Theme / Free Templates
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote