i would like to know is it possible?
AAA = (123) (1234) (12345) (123456) (1234567) (54321)
i would like to search useing regex only
inside of parenthesis the sum is 5
please help...
question regex search help please
Re: question regex search help please
When you say if the sum is 5, do you mean you want to have a result when there is only five number? Like this:
Code: Select all
#Persistent
AAA := "(123) (1234) (12345) (123456) (1234567) (54321)"
pos := 0
indice := 0
foundItems := Object()
element :=
While, pos := RegExMatch(AAA, "\(.*?\)", entree, pos + 1)
{
taille := StrLen(entree)
If(taille == 7){
indice += 1
foundItems[ indice ] := entree
}
}
Loop %indice%
{
MsgBox, % foundItems[A_Index]
}
Re: question regex search help please
I agree with Paneb, the goal here is kind of vague, particularly since what you appear to want doesn't even show up in your example:
Code: Select all
AAA=(123) (1234) (12345) (123456) (1234567) (54321)
Pos=1
While Pos := RegExMatch(AAA,"\(\K\d+(?=\))",m,Pos+StrLen(m))
{
sum := 0
Loop, parse, m
sum += A_LoopField
MsgBox, The sum is %sum%.
}
return
Re: question regex search help please
Thank you for helping alot!
Who is online
Users browsing this forum: CrowexBR, mebelantikjaya and 306 guests