in reply to How to get only the next word matching the regex in the line

If it is consistently formatted then you can be more specific with your capture and look for 'test\d+'.

$current_line =~ /Grab this\s+('test\d+')/