Jump to content
Sign in to follow this  
Shenghi

Regex - optional match

Recommended Posts

is it me, or... is it a bug in the way AutoIt handles regular expressions?

I have the following string:

$string = "moo1 moo2 moo3 moo4 moo5"

The following regexes _should_ all match, but they don't.

(^|\032)moo1($|\032) - doesn't match
(^|\032)moo2($|\032) - matches
(^|\032)moo3($|\032) - matches
(^|\032)moo4($|\032) - matches
(^|\032)moo5($|\032) - doesn't match

Is there a way around this?

Edited by Shenghi

Share this post


Link to post
Share on other sites

is it me, or... is it a bug in the way AutoIt handles regular expressions?

I have the following string:

$string = "moo1 moo2 moo3 moo4 moo5"

The following regexes _should_ all match, but they don't.

(^|\032)moo1($|\032) - doesn't match
(^|\032)moo2($|\032) - matches
(^|\032)moo3($|\032) - matches
(^|\032)moo4($|\032) - matches
(^|\032)moo5($|\032) - doesn't match

Is there a way around this?

Add a Space infront and behind $string before regex.

Share this post


Link to post
Share on other sites

Add a Space infront and behind $string before regex.

Heh, nice way arround it :P However, when working with Tokens (which is what I am doing) I doubt it's a real solution. I'll ditch the regex, I guess.

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  

×
×
  • Create New...