Suppir Posted February 10, 2010 Share Posted February 10, 2010 (edited) Hello!Is it possible to adjust the way regular expressions working in AutoIt?It will be very nice if we could write:if StringRegExp($sLine, "Some text (\d+)") Then MsgBox(0, "", $LastMatch[0])So, I propose special variable(array) in AutoIt, that will consists of last matches done with StringRegExp()I could be named $LastMatch[x] or something shorter. Edited February 10, 2010 by Suppir Link to comment Share on other sites More sharing options...
bogQ Posted February 10, 2010 Share Posted February 10, 2010 (edited) Well if StringRegExp return array (look at [, flag ] in felp file for command) you can use msgbox $LastMatch[$LastMatch[0]] _ArrayInsert($LastMatch, 0, UBound($LastMatch)) That shud put nuber of lines from array in first array [0] if its not already there that is Edited February 10, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
ProgAndy Posted February 10, 2010 Share Posted February 10, 2010 (edited) If you need the results, you have to write 2 lines, thats not too much And it is cleaner code. $aResults = StringRegExp("test", "s", 1) If Not @error Then MsgBox(0, '', $aResults[0]) Edited February 10, 2010 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
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