cdr Posted August 18, 2006 Posted August 18, 2006 (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 August 18, 2006 by cdr
lod3n Posted August 18, 2006 Posted August 18, 2006 (edited) 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 August 18, 2006 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
cdr Posted August 18, 2006 Author Posted August 18, 2006 (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 August 18, 2006 by cdr
cdr Posted August 21, 2006 Author Posted August 21, 2006 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now