Jump to content

Recommended Posts

Posted (edited)

If I run in autoit:

$test = "Test passed on";
$matchArray = StringRegExp( $test, "(?i)(pass([a-z]?)+[. \-]+[a-z0-9]+)", 1 )

It matches the "e".

However, if I put the pattern in something else that uses regex, like Regex Doctor, the pattern matches "passed on" fine.

What's up?

Edited by cdr
Posted (edited)

Not sure what you mean, but it returns [ e, d, passed on ] when I want it to return just [ passed on ].

I don't see what's wrong.

#include <array.au3>
$test = "Test passed on";
$matchArray = StringRegExp( $test, "(?i)(pass([a-z]?)+[. \-]+[a-z0-9]+)", 1 )
_ArrayDisplay($matchArray,"result")
Edited by cdr
Posted

I guess the problem is the ([a-z]?)+, since it's a subgroup and returns its own matches.

I don't know how else to do it though, {0,} doesn't work for some reason and I don't know why.

I could do something like "(?i)(pass[a-z]{0,10}[. \-]+[a-z0-9]+)", but I prefer a general solution.

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
×
×
  • Create New...