Jump to content
Sign in to follow this  
McGod

StringRegExp

Recommended Posts

McGod

$array = StringRegExp('Required Level: 40', '\A(?i)Required Level: (.+?)', 3)

Only returns a 4. Something wrong with my (.+?) ? Replacing the + with a * gives me nothing:(

Share this post


Link to post
Share on other sites
Nahuel

Any of these should work:

$array = StringRegExp('Required Level: 40', '[0-9]{2}', 1)
MsgBox(0,"",$array[0])

$array = StringRegExp('Required Level: 40', '[[:digit:]]+', 1)
MsgBox(0,"",$array[0])

-edit-

For yours to work, just remove the ? from (.+?)

Edited by Nahuel

Share this post


Link to post
Share on other sites
SmOke_N

What is \A for?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
McGod

Removing the ? worked, thanks.

Smoke_N: \A Match only at beginning of string.

Need for incase something like

Dexterity: 15

Required Dexerity: 15

would both be postive for

Dexterity: (.+)

although with a \A only the first one would be.

Share this post


Link to post
Share on other sites
SmOke_N

Removing the ? worked, thanks.

Smoke_N: \A Match only at beginning of string.

Need for incase something like

Dexterity: 15

Required Dexerity: 15

would both be postive for

Dexterity: (.+)

although with a \A only the first one would be.

^

The above you can use to match at the beginning of a string.

(?i)^Dexterity: (.+?)

That will match any chars from the start of the space until the end of the string (not case sensitive).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

×