peter1950
asked on
Validate time / date with regular expression
Hi
I must convert NMEA UTC time and date to VB.NET DateTime variable.
I want validate NMEA Time (for example "182635.000" = 6:26:35 PM / 18:26:35; 000 are milliseconds that i don't use in my time variable but i want use to validation) with regular expression, but It's to difficult. Can anyone help me ?
And for validating a UTC date "181007" (18th October 2007)
Thanks
I must convert NMEA UTC time and date to VB.NET DateTime variable.
I want validate NMEA Time (for example "182635.000" = 6:26:35 PM / 18:26:35; 000 are milliseconds that i don't use in my time variable but i want use to validation) with regular expression, but It's to difficult. Can anyone help me ?
And for validating a UTC date "181007" (18th October 2007)
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
\d{6}\.\d{3}
Bob
Bob
ASKER
And if I want to use
([0-2][0-3]|[0-1][0-9])[0- 5][0-9][0- 5][0-9]\.\ d{3}
and
\d{6}\.\d{3} together ?
I try
([0-2][0-3]|[0-1][0-9])[0- 5][0-9][0- 5][0-9]\d{ 6}\.\d{3} but it doesn't work.
([0-2][0-3]|[0-1][0-9])[0-
and
\d{6}\.\d{3} together ?
I try
([0-2][0-3]|[0-1][0-9])[0-
ASKER
Excuse me.
With
([0-2][0-3]|[0-1][0-9])[0- 5][0-9][0- 5][0-9]
obtain the same result as
\d{6}.
And for validating a date ?
With
([0-2][0-3]|[0-1][0-9])[0-
obtain the same result as
\d{6}.
And for validating a date ?
I don't understand. Are you looking to combine those two validation expressions into a single one?
Bob
Bob
ASKER
And if I want to test that the lenght Is exactly 10 chars and that the first 6 chars are digit ?