somdcomputerguy Posted June 20, 2011 Posted June 20, 2011 I know that this is an old post, but can someone help me out? I am trying to get this script to work, but I think google changed their page, and it is no longer working right. Here is the code that I see when I pull the source of the page. Can someone help with the stringregexp part? <td style="font-size: medium;"><b>22:27</b> Sunday (EDT) - <b>Time</b> in <b>Toronto, ON, Canada</b></td> I want to extract the time only. #include <String.au3> $String = '<td style="font-size: medium;"><b>22:27</b> Sunday (EDT) - <b>Time</b> in <b>Toronto, ON, Canada</b></td>' $StringArray = _StringBetween($String, '<b>', '</b>') ConsoleWrite($StringArray[0] & @LF) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Foxhound Posted June 20, 2011 Posted June 20, 2011 (edited) \d{2}:\d{2} works in regex tester but not in AutoIT. I'll keep trying and see what I come up with. EDIT: I'm an idiot >.< Had the wrong flags set on StringRegExp(). \d{1,2}:\d{1,2} will pick out just the time: $str = '<td style="font-size: medium;"><b>22:27</b> Sunday (EDT) - <b>Time</b> in <b>Toronto, ON, Canada</b></td>' $regex = '\d{1,2}:\d{1,2}' $match = StringRegExp($str,$regex,1) if IsArray($match) Then MsgBox(0,"",$match[0]) Else MsgBox(0,"","No match") EndIf Edited June 20, 2011 by Foxhound [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote]
bartekd Posted June 20, 2011 Posted June 20, 2011 that works like a charm. Thanks very much for your help.
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