Jump to content

Recommended Posts

Posted

Hello All,

I don't always understand the StringRegExp syntax. I have today a syntax problem

with the | statement.

$inc = "251"
if StringRegExp( $inc , "^251$|^ABC$",0) = False then
    MsgBox(0,"Error","The value "&$inc&" is not authorized")
EndIf
MsgBox(0,"Error",@error)

StringRegExp returns False...

If I do

$inc = "251"
if StringRegExp( $inc , "^251$",0) = False then
    MsgBox(0,"Error","The value "&$inc&" is not authorized")
EndIf
MsgBox(0,"Error",@error)

StringRegExp returns True ...

I use this kind of statement with Mysql without troubles ;

mysql> select "251" regexp "^251$|^ABC$" ;

Which returns True...

So, I don't understand what I am doing wrong with AutoIt..

Any Help ???

Regards,

Francis

Posted

There are currently some open StringRegExp() bugs in the Bug Reports forum; they may possibly be having an effect on your code. You may however wish to try '(^251$)|(^ABC$)' or '^(251|ABC)$' to see if that works properly.

Posted (edited)

There are currently some open StringRegExp() bugs in the Bug Reports forum; they may possibly be having an effect on your code. You may however wish to try '(^251$)|(^ABC$)' or '^(251|ABC)$' to see if that works properly.

Thanks for your answer. I will check that ( didn't know that this open bugs forum exists...)

Regards,

Francis

Edited by Francis Lennert (France)

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
×
×
  • Create New...