mIRC Home    About    Download    Register    News    Help

Print Thread
#174317 05/04/07 02:59 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
say for e.g i do /ctcp Bob time

he replies with
4/05/2007 3:55:43 PM

how can i check the format of this returned time matches the format of $time(m/dd/yyyy h:nn:ss TT) ?
(note: dnt want to check the time value, jsut to see if its the correct format)

pouncer #174319 05/04/07 04:10 PM
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Jan 2007
Posts: 259
You could use $regex (thought it would be very long for accurate checks):
Code:
alias confirmdate {
  return $iif($regex($1-,/(?:1/[0-2]\d|1/3[0-1]|2/[0-2]\d|3/[0-2]\d|3/3[0-1]|4/[0-2]\d|4/30|5/[0-2]\d|5/3[0-1]|6/[0-2]\d|6/30|7/[0-2]\d|7/3[0-1]|8/[0-2]\d|8/3[0-1]|9/[0-2]\d|9/30|10/[0-2]\d|10/3[0-1]|11/[0-2]\d|11/30|12/[0-2]\d|12/3[0-1])/\d{4} (?:1[0-2]|\d)\:[0-6]{2}\:[0-6]{2} (?:PM|AM)/) == 1,$true,$false)
}

Returns $true if its valid, $false otherwise.


Those who can, cannot. Those who cannot, can.

Link Copied to Clipboard