MasonMill Posted July 22, 2014 Posted July 22, 2014 Ive been having difficulty trying to devise a stringregexp search. Im looking through a webpage source and looking for titles. I know the string lies between <title> and </title> but they will all have different lengths with possibly any character. I can find them by: StringRegExp($Source,'/S(?:</title>)',3) then StringRegExp($Source,'/S/S(?:</title>)',3) etc etc but I dont know how to do: StringRegExp($Source,'(?:<title>)(put something here to fiund any string)(?:</title>)',3) Any ideas? Thanks in advance!
sahsanu Posted July 22, 2014 Posted July 22, 2014 You can use just (.+?): StringRegExp($Source,'(?:<title>)(.+?)(?:</title>)',3)
Malkey Posted July 22, 2014 Posted July 22, 2014 Or, try this. #include <Array.au3> Local $Source = BinaryToString(InetRead("http://www.autoitscript.com/forum/topic/162968-stringregexp-question/#entry1186162")) ;ConsoleWrite($Source & @LF) Local $sSearchFor = "Question" Local $sTitle = StringRegExp($Source, '(?is)(?:<title>)(.*?\Q' & $sSearchFor & '\E.*?)(?:</title>)', 3) _ArrayDisplay($sTitle)
MasonMill Posted July 22, 2014 Author Posted July 22, 2014 Awesome, thanks! I will give these a try tomorrow when I get back to work.
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