in reply to regex: extract multiple number of date patterns from certain lines

Can you use the trailing ,\d on the initial date/time to disambiguate? Consider:

use strict; use warnings; while (my $line = <DATA>) { my @parts = $line =~ /(\d{4}-\d{2}-\d{2})(?:,\s|$)/g; print $line; print " ", join ("\n ", @parts), "\n"; } __DATA__ 2009-02-02 06:12:57,500 dates processed: 2009-01-31, 2009-01-29, 2009- +01-30 2009-02-18 06:03:47,713 dates processed: 2009-02-16, 2009-02-17 2009-02-19 05:58:29,138 dates processed: 2009-02-18

Prints:

2009-02-02 06:12:57,500 dates processed: 2009-01-31, 2009-01-29, 2009- +01-30 2009-01-31 2009-01-29 2009-01-30 2009-02-18 06:03:47,713 dates processed: 2009-02-16, 2009-02-17 2009-02-16 2009-02-17 2009-02-19 05:58:29,138 dates processed: 2009-02-18 2009-02-18

True laziness is hard work