Xand3r Posted November 21, 2009 Share Posted November 21, 2009 (edited) $data1="test test test test " $data2="test" $pattern=".{4,}"$reg1=StringRegExp($data1,$pattern) $reg2=StringRegExp($data2,$pattern) MsgBox(0 , "SRE" , $reg1 & ":" & $reg2) I want it to match repeating sequences only 4 or more times what should i change the $pattern to so the msgbox shows "1 : 0" ? Edited November 22, 2009 by Xand3r Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Malkey Posted November 21, 2009 Share Posted November 21, 2009 $data1="test test test test " $data2="test" $pattern=".{4,}"$reg1=StringRegExp($data1,$pattern) $reg2=StringRegExp($data2,$pattern) MsgBox(0 , "SRE" , $reg1 & ":" & $reg2) I want it to match repeating sequences only 4 or more times what should i change the $pattern to so the msgbox shows "1 : 0" ? Maybe something like this. #include <Array.au3> $data1 = "test test test test " ;test test test test test test test test test test test test " $data2 = "test" $pattern = "(\w+\h*)(?:\1){3,}" $reg1 = StringRegExp($data1, $pattern) $reg2 = StringRegExp($data2, $pattern) MsgBox(0, "SRE", $reg1 & ":" & $reg2) ;======= This section to help show what's happening only ======= $pattern = "(\w+\h*)(?:\1){3,}" ; "; $reg1 = StringRegExp($data1, $pattern, 3) $reg2 = StringRegExp($data2, $pattern, 3) _ArrayDisplay($reg1) MsgBox(0, "Display", UBound($reg1) & ":" & UBound($reg2)) ;=============================================================== Link to comment Share on other sites More sharing options...
Xand3r Posted November 22, 2009 Author Share Posted November 22, 2009 Maybe something like this. #include <Array.au3> $data1 = "test test test test " ;test test test test test test test test test test test test " $data2 = "test" $pattern = "(\w+\h*)(?:\1){3,}" $reg1 = StringRegExp($data1, $pattern) $reg2 = StringRegExp($data2, $pattern) MsgBox(0, "SRE", $reg1 & ":" & $reg2) ;======= This section to help show what's happening only ======= $pattern = "(\w+\h*)(?:\1){3,}" ; "; $reg1 = StringRegExp($data1, $pattern, 3) $reg2 = StringRegExp($data2, $pattern, 3) _ArrayDisplay($reg1) MsgBox(0, "Display", UBound($reg1) & ":" & UBound($reg2)) ;=============================================================== thanks alot Malkey that's exactly what i was looking for Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
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