in reply to Re^2: Capture groups
in thread Capture groups
IMO, it's "easier" to get rid of the trailing spaces (not required by OP, so Joost's correct answer is perfectly serviceable for the specs given) in the original match:
if ( $string =~ /([A-Za-z]*\s[A-Za-z]*)\s+([0-9]{1,2}[%])/ ) { print $1 . "\n" . $2; # ^ } else ...
|
|---|