I have the following string:
Giants 2 9 : 10 L.Tynes 22 yd . Field Goal ( 4 - - 3 , 1 : 20 ) 0 3 Cowboys 2 1 : 01 K.Ogletree 10 yd . pass from T.Romo ( D.Bailey kick ) ( 7 - 73 , 2 : 33 ) 7 3 Cowboys 3 10 : 24 K.Ogletree 40 yd . pass from T.Romo ( D.Bailey kick ) ( 9 - 80 , 4 : 36 ) 14 3 Giants 3 5 : 11 A.Bradshaw 10 yd . run ( L.Tynes kick ) ( 9 - 89 , 5 : 13 ) 14 10 Cowboys 3 0 : 40 D.Bailey 33 yd . Field Goal ( 8 - 65 , 4 : 31 ) 17 10 Cowboys 4 5 : 57 M.Austin 34 yd . pass from T.Romo ( D.Bailey kick ) ( 8 - 82 , 7 : 06 ) 24 10 Giants 4 2 : 36 M.Bennett 9 yd . pass from E.Manning ( L.Tynes kick ) ( 12 - 79 , 3 : 21 ) 24 17 Time : 2 : 53
The prefix to the subtrings will either be “Cowboys” or “Giants”. The string always ends with a right parenthesis ) and two numbers.
I can’t even imagine what Regex to use. I can use string functions and loop over the string, but a Regex would help me later on. Maybe I could use the split function, but that’s over my head.
I suppose I could parse “Cowboys” then “Giants”.
I think this RegEx gives what you want:
“Cowboys” or “Giants” followed by arbitrary characters until you get a right paren, a space, some digits, a space, and some more digits.