Code: Select all
q::
str := "yellow3xxxyellow2xxxyellow1xxxbluexxxred1xxxred2xxxred3xxxyellow....against...yellow2xxxblue2xxxred2...againt...yellow3xxxblue3xxxred3"
p := 1
array := []
while p:= RegExMatch(str, "yellow(?:(?!yellow).)*?blue.*?red", m, p+StrLen(m))
{
Array[A_Index] := m ;esto sólo recupera el subpatron
msgbox % "Element number " . A_Index . " is " . Array[A_Index]
Count := Array.Count()
}
msgbox, % "count =" Count
return
;msgbox, % "count =" Count
Z::
ExitApp
Thanks in advance:
note: I would not like to use InStr() and SubStr(), I would really like just one line of code with regexmatch if possible.