Sign in to follow this  
Followers 0
Shenghi

Regex - optional match

4 posts in this topic

#1 ·  Posted (edited)

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



perhaps

(^|\032)moo[1-5]($|\032)

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.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  
Followers 0