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? Quote Link to comment Share on other sites More sharing options...
Alex Posted May 26, 2010 Share Posted May 26, 2010 try: ~\[youtube=([^\]]+)\]~ Quote Link to comment 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=(.+?)\]/ Quote Link to comment 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... Quote Link to comment 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.