Jump to content

StringRegExp


McGod
 Share

Recommended Posts

$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:(

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...