Reputation: 1139
I am wondering if anyone could give me help with writing a regular expression to extract just the seconds and milliseconds of a particular timestamp.
example timestamp below:
15:45:30.192
I am writing this script in perl. Any help would be greatly appreciated.
Upvotes: 2
Views: 1288
Reputation: 69440
This should work:
$timestamp =~ /:(\d+)\.(d+)/
$sec = $1;
$mil = $2;
Upvotes: 1
Reputation: 396
($sec,$millisec)=$_=~/\d+:\d+:(\d+).(\d+)/
($time)=$_=~/\d+:\d+:(\d+.\d+)/
Upvotes: 3