in reply to Regex: Optional/alternative catpures
Minor adjustment:
$line =~ / ^ (.+?) (?: < (two|three) > )? $ /xs; [download]
Another approach:
my $pre= $line; my $post= ''; if( $pre =~ s/ \s* < (two|three) > $ //xs ) { $post= $1; } [download]
- tye