RegEx issue. Of course....
Posted: 08 Feb 2018, 19:09
I tried a bunch of googling and jeesweg's examples and just could not solve the GA RegEx.
Im trying to extract any and all matches with RegExMatch for some anims. I want to modify the anims easy and create sequences so the easiest way i thought was to use variables with multiple entries. I did not actually start on it, trying to find the solution to separate stuff first.
So, anyone know the regex thing for extracting something like this:
I tried mutliple RegEx combos, this being the latest.
Now, i could use tons of loops that would match one by one and removing one entry at a time but i thought a regex match would be much more efficient because it already sets any match to an array that i can later parse. Any thoughts?
Im trying to extract any and all matches with RegExMatch for some anims. I want to modify the anims easy and create sequences so the easiest way i thought was to use variables with multiple entries. I did not actually start on it, trying to find the solution to separate stuff first.
So, anyone know the regex thing for extracting something like this:
I tried mutliple RegEx combos, this being the latest.
Code: Select all
; The anim instructins that should take place.
AnimSeq=[Action: PlayOnce] [Move: X "500"] [Move: Y "200"] [Action: AnimEnd]
AnimSeq2=[Action: Play "3"] [Move: X "500"] [Move: Y "300"] [FrameCount: 35] [Action: Finish]
; Remove spaces because its one constants not needed for any evaluations?
StringReplace, AnimSeq, AnimSeq, %A_Space%, , All
; Find the d*** things and store them into separate Command[] array.
MatchCount:=RegExMatch(AnimSeq,"i)(\[Action:.+?])+|(\[Move:.+?])",Command)
; Loop through the RegEx results, later should be replaced with actual animation instructions.
Loop %MatchCount%
{
ShowCommand:=Command%A_Index%
tooltip %A_Index%/%MatchCount%`n----------`n%ShowCommand%, 700, 200
Sleep 1000
}
tooltip
Return