Jump to content
Sign in to follow this  
thomasl

Regular expressions?

Recommended Posts

thomasl

I see that there are several built-in functions dealing with regexes in AU3; I have also downloaded the scraps of doc I could find and translated some of my Perl scripts to use them.

However, I run into two problems: performance and crashes.

StringRegExp and ...Replace can be extremely slow for bigger files (some of my files have 1mb of data to process); worse, they always crash when the size of the strings to search or replace grows beyond a certain limit. (This is difficult to nail down but sometimes even 60 or 80kb of data are enough for a crash.)

Does it make sense to use these built-in functions? They are not formally documented, so I am not sure what their status is.

As it is, I am tempted to write a few simple interface functions so that I can use Perl's regular expressions from AU3 scripts. (Perl's regexes are also more powerful than the built-in stuff, I think.)

Share this post


Link to post
Share on other sites
jpm

I see that there are several built-in functions dealing with regexes in AU3; I have also downloaded the scraps of doc I could find and translated some of my Perl scripts to use them.

However, I run into two problems: performance and crashes.

StringRegExp and ...Replace can be extremely slow for bigger files (some of my files have 1mb of data to process); worse, they always crash when the size of the strings to search or replace grows beyond a certain limit. (This is difficult to nail down but sometimes even 60 or 80kb of data are enough for a crash.)

Does it make sense to use these built-in functions? They are not formally documented, so I am not sure what their status is.

As it is, I am tempted to write a few simple interface functions so that I can use Perl's regular expressions from AU3 scripts. (Perl's regexes are also more powerful than the built-in stuff, I think.)

Those functions are not part of the doc because we know there are some bugs specically when they return empty strings.

Nevertheless can you document with suitable scripts the perf and crash problems so Nutster (the designer) can have a look at them?

Thanks for your cooperation. :P

Share this post


Link to post
Share on other sites
Stumpii

You may want to look at this in the mean time:

StringRegExpVBS


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites
trids

As it is, I am tempted to write a few simple interface functions so that I can use Perl's regular expressions from AU3 scripts. (Perl's regexes are also more powerful than the built-in stuff, I think.)

Sounds interesting! I like the idea of using a standardised RegExp for AU3, even if it's just to make portability easier.

How would it work? Are you looking at creating an EXE that you can drive with commandline parameters (minitrue worked like this, but only on pre-Win2K operating systems). Or will it be via DllCall? Will you be able to use it without having to install a Perl engine?

Share this post


Link to post
Share on other sites
thomasl

Those functions are not part of the doc because we know there are some bugs specically when they return empty strings.

Nevertheless can you document with suitable scripts the perf and crash problems so Nutster (the designer) can have a look at them?

The performance thing is obvious: a regex in a Perl script needs about 0.1 sec to process 80kb, whereas the same in AU3 takes some 3 or 4 secs (all other things being equal). Other cases are even worse: sometimes I see a factor of 150.

As to the crashes, hm.. that's not so easy. They do not follow an easily recognisable pattern... it's just that at some point the thing crashes, sometimes after 60kb, sometimes after 80.

I will later post a stripped-down script that crashes reliably :P

Share this post


Link to post
Share on other sites
vim

The performance thing is obvious: a regex in a Perl script needs about 0.1 sec to process 80kb, whereas the same in AU3 takes some 3 or 4 secs (all other things being equal). Other cases are even worse: sometimes I see a factor of 150.

As to the crashes, hm.. that's not so easy. They do not follow an easily recognisable pattern... it's just that at some point the thing crashes, sometimes after 60kb, sometimes after 80.

I will later post a stripped-down script that crashes reliably :P

This topic has been hammered around for a while now. I use AWK to process my regular expressions. I know there's an awkdll. Maybe I'll go that route.

Share this post


Link to post
Share on other sites
thomasl

How would it work? Are you looking at creating an EXE that you can drive with commandline parameters (minitrue worked like this, but only on pre-Win2K operating systems).

Gosh, no. I would certainly call Perl directly, via DllCall.

Will you be able to use it without having to install a Perl engine?

It would probably not need a fullblown Perl installation, just one freely available DLL.

But I first have to investigate that as I have Perl installed on all my machines :P

More will follow...

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.