Not quite; if you've found "1234567890" or "^\s*\d+\s*$" in 'line', then any line after that which matches r"->" should trigger the logic.