in reply to need a complex regex
You don't say whether you are processing this line by line, or need to extract your bits from a multiline lump of data. You are also not at all clear as to which parts of the lines you wish to keep, and whether you want to capture them as 2 or 3 pieces.
This assumes that you processing line by line and want 3 pieces from each line.
if( $line =~ /^([^:]+): (.+) \((\d+) minutes ago\)$/ ) { my( $name, $text, $delay ) = ( $1, $2, $3 ); }
The regex is saying
followed by one or more digits (captured to $3),
followed b y the literal text ' minutes ago)',
followed by the end of line.
|
|---|