#!/usr/bin/perl @searchstr = ("12:33 PM" , "9:59 AM" , "43:96 PM" , "23:59" ); @match1 = grep /(1[012]|[1-9]):[0-5][0-9].(AM|PM)/i, @searchstr; @match2 = grep /([01]?[4-9]|[012][0-3]:[0-5][0-9])$/, @searchstr; print "Content-type:text/html\n\n"; print "12時間表示 = @match1<br>"; print "24時間表示 = @match2<br>"; ●出力結果 12時間表示 = 12:33 PM 9:59 AM 24時間表示 = 23:59