DJKMan Posted February 15, 2010 Posted February 15, 2010 I know I need to use regular expression to do this. I'm not quite that good with regular expression yet. I've read some articles and it appears no one has found an official solution for the dynamic youtube links.Here's an example:some text and then some textNote: I grabbed these links from the example forums that have attempted to use regular expression to achieve this. I never really looked at the vids (it's not important).
James Posted February 15, 2010 Posted February 15, 2010 DJKMAN, This should work for you Dim $searchString = "some text http://www.youtube.com/watch?v=szygGmDsAl4&search_query=testing&search=Search and then some text" ; This could be a file If FindYT($searchString) Then MsgBox(0, @ScriptName, "I found a YouTube link!") Else MsgBox(0, @ScriptName, "No YouTube link :(") EndIf Func FindYT($ioString) Local $RegEx = "(http://www.youtube.com)?/(v/([-|~_0-9A-Za-z]+)|watch\?v\=([-|~_0-9A-Za-z&=]+)?.*?)" If StringRegExp($ioString, $RegEx) Then Return 1 Else Return 0 EndIf EndFunc James Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
DJKMan Posted February 15, 2010 Author Posted February 15, 2010 Wow! Thank you for your quick response. I appreciate it. It works exactly as I wanted. (Of course, I'll give credits.)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now