Leonick Posted June 29, 2009 Posted June 29, 2009 Hi guys.... Struggling around for 3 days to learn regexp now.... got already some results, which i could implemented succesfully. Reading the help over and over,....doesnt help much,...so mostly I found everything out through examples. Trying to get the time in a text: $data="WordA 09:17:58 blabla" $time = StringRegExp($data,'(?:WordA)(?:.*?)(\d+)', 1) ConsoleWrite($time[0]&@LF)oÝ÷ Ù¬º[jºtö«¨´§¨¶Ø^Â%zئy©Ývíëb¶l«zË¥¶ÈhºW[z«¨·Ouï*ºl¢g)àÂ+aÂÝn§uªònëmè^hzÉí±¬°êÞ¶n¶+bâºw^®ËZÛaÈÂ¥v¥¦g¯z¼¦¹ÈlyÊ'v«²Ø¨'ò¢æ«zËbY赺+yÙhëçg£h±ê^«^¶¬x%zئzÉbëajÛbí but when the time only consists of two numbers like: "09:45" its not working!! loooooool HEADACHE...... If i would understand this.....I could make a big step in unterstanding regexp Thank you for anyone who is willing to expalin. Leonick
PsaltyDS Posted June 29, 2009 Posted June 29, 2009 RegExp: Geeky fun for the whole family! #include <Array.au3> Global $avData[2] = ["WordA 09:17:58 blabla", "WordA 09:17 blabla"] For $n = 0 to UBound($avData) - 1 $time = StringRegExp($avData[$n],'(?:WordA)(?:\D*)(\d{2}:\d{2}(:\d{2})?)', 3) _ArrayDisplay($time, "$time") Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ResNullius Posted June 29, 2009 Posted June 29, 2009 Or with StringRegExpReplace $data="WordA 09:17:58 blabla" $time = StringRegExpReplace($data, "(.*?)((\d{2}:){1,2}\d{2})(.*)", "\2") ConsoleWrite($time & @CRLF)
Leonick Posted June 29, 2009 Author Posted June 29, 2009 Geeky fun for the whole family...looool I think my family will stare to me like a sheep if i wanna explain them. Woooow....i think that will help me out. Of course i dont wanna simple use your stuff, but mostly important I wanna understand it. Going to figure it out in a few minutes...just wanted to say "Big Thank You" If i dont get it,....then i am going to ask back if i may :-)
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