SchweppesAle Posted May 25, 2010 Share Posted May 25, 2010 Hi, I need to learn how to write a REGEX which will parse the following strings and return each of their youtube video urls(minus the [youtube= and ], etc). [youtube=http://www.youtube.com/watch?v=something] [youtube=http://www.youtube.com/watch?v=something2] How can this be done? Link to comment https://forums.phpfreaks.com/topic/202886-retrieving-tag-urls/ Share on other sites More sharing options...
Alex Posted May 26, 2010 Share Posted May 26, 2010 try: ~\[youtube=([^\]]+)\]~ Link to comment https://forums.phpfreaks.com/topic/202886-retrieving-tag-urls/#findComment-1063529 Share on other sites More sharing options...
Adam Posted May 26, 2010 Share Posted May 26, 2010 I think this is a little easier on the eyes: /\[youtube=(.+?)\]/ Link to comment https://forums.phpfreaks.com/topic/202886-retrieving-tag-urls/#findComment-1063531 Share on other sites More sharing options...
.josh Posted May 28, 2010 Share Posted May 28, 2010 except that a negative char class is safer than a lazy quantifier... Link to comment https://forums.phpfreaks.com/topic/202886-retrieving-tag-urls/#findComment-1064865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.