Jump to content

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

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

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...