Perl

Extract hh:mm:ss with capturing group () in the following datetime

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

my $date = "Fri Nov 19 20:09:37 CET 2021";
my @matches = $date =~ /(.*)(\d{2}:\d{2}:\d{2})(.*)/;
print $matches[1];
# Output: 20:09:37