Off-hand... this is how I'd do it.
Code:
lines_to_look_for = [ "You have \d+ repetition(s) remaining",
"You have completed this Stun Maneuvers task",
]
line_that_matched = waitfor( *lines_to_look_for )
reps_remaining = line_that_matched.slice(/\d+/)
The lines_to_look_for variable is an array; this way to add a line that matches, all you have to do is paste it in on a new line. Without going into agonizingly over-descriptive detail, if you put an asterisk in front of an array when passing the array as an argument to a method, then the array isn't passed as a single variable -- its elements are themselves passed as the arguments. Ruby likes to call it "splat" something or other...
e.g., in the above code, that waitfor method will receive exactly the same arguments as it would if you instead wrote it this way:
Code:
line_that_matched = waitfor( "You have \d+ repetition(s) remaining", "You have completed this Stun Maneuvers task" )
It may help you to understand whatever isn't working as expected if you bear in mind that most of the very basic methods (match, waitfor, pause, etc.) are meant to be very forgiving and very flexible. That said, I have no idea why a string with parentheses in it wouldn't work; that should be just fine. Make sure it isn't the period that's screwing it up, since it's being interpreted as a "lite" regular expression.