Sign in to follow this  
Followers 0
Suppir

Reorganize StringRegExp()

3 posts in this topic

#1 ·  Posted (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 by Suppir

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 :D

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you need the results, you have to write 2 lines, thats not too much :D And it is cleaner code.

$aResults = StringRegExp("test", "s", 1)
If Not @error Then MsgBox(0, '', $aResults[0])
Edited 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0