Sign in to follow this  
Followers 0
mdes

StringRegExp: ".*" eats following character

5 posts in this topic

#1 ·  Posted (edited)

On lines like

balblabla = 84.99.34.3
StringRegExp($Line, ".*(\d+\.\d+\.\d+\.\d+)", 1)
is returning "4.99.34.3"
StringRegExp($Line, ".*( \d+\.\d+\.\d+\.\d+)", 1)
is returning " 84.99.34.3"
StringRegExp($Line, ".*(\d*\.\d+\.\d+\.\d+)", 1)
is returning ".99.34.3"

Strange, isn't it! Is it a bug :)

Edited by mdes

Gestion des congés, RTT, vacances scolaires, autres absences sur Pocket PC : CongésRFV

Share this post


Link to post
Share on other sites



I thought I read in the bug section that regexp is currently broken, check there.


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

I will check this one out as well, then. Thanks for the feedback.


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

The behaviour I got is what is shown above and is the correct behaviour for the patterns specified.

The key here is that .* collects as many characters as possible, that still allows the following pattern to work. The choose smaller selections, put a question mark (?) after the splat (*).


David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites

When I've tried this, it failed for me as well. Specifically if you do something like xyz.*(abc) the .* is too greedy and always eats everything until the eol.

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