Jump to content
Sign in to follow this  
inwmsn

StringRegExp with () fail

Recommended Posts

inwmsn

Hi All, I couldn't figure out why StringRegExp function returm fail if the expression is including "(someword)" here is my code

#include <IE.au3>

$oIE = _IEAttach ("My Video")

$Text = _IEBodyReadText ($oIE)

If StringRegExp ($Text, "This is my (dog)") Then ;;;;===> It's fail when I use "(dog)"

MsgBox (0,"","FOUND")

Else

MsgBox (0,"","NOT FOUND")

EndIf

I got "NOT FOUND" but if I take "(dog)" out it FOUND like this

$oIE = _IEAttach ("My Video")

$Text = _IEBodyReadText ($oIE)

If StringRegExp ($Text, "This is my") Then ;;;;===> It's work when I take "(dog)" out

MsgBox (0,"","FOUND")

Else

MsgBox (0,"","NOT FOUND")

EndIf

Can somebody helping me. Thanks

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

what about escaping the ( and ) with this \( and \)

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
inwmsn

It's work!!!!! Thank you!! Xenobiologist ^^

Share this post


Link to post
Share on other sites
inwmsn

Hi Xenobiologist. Anyway it come up another problem when change the code like this

Dim $Array [3] = ["cat", "\(dog\)", "hourse")

For $i = 0 To UBound ($Array) -1

$oIE = _IEAttach ("My Video")

$Text = _IEBodyReadText ($oIE)

If StringRegExp ($Text, $Array [$i]);;;; ====> It work just fine.

_IELinkClickByText ($oIE, $Array [$i]);;;;===> But It won't click on the second element of array

Else

MsgBox (0,"","NOT FOUND")

EndIf

Please help again. Thanks

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

why not changing StringRegExp to StringInStr ?

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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.