in reply to Help with a more precise regex

Hi, This one should work fine and detect all "format errors":
for ("2D 3h", "2d", "3h", "3h 2d", "Some string") { my ($day, $hour) = map {$_+0} /^(?:(\d+)d\s*)?(?:(\d+)h)?$/i; $day || $hour ? print "Day - $day, hour - $hour\n" : warn "Wrong fo +rmat $_" }
Sincerely, Nikita Savin