Write a regex to validate a 24 hours time string.
See examples to figure out what you should check for:

Accepted:
01:00 - 1:00  

Not accepted:

24:00

You should check for correct length and no spaces.

Difficulty: EASY
Starter code: def validate_time(time):
	

Solutions:
import re
_24H = re.compile('^([01]?\\d|2[0-3]):[0-5]\\d$')
validate_time = lambda time: bool(_24H.match(time))


import re

def validate_time(timestamp):
	return bool(re.match('(2[0-3]|[01]?\\d):[0-5]\\d$', timestamp))


import re

def validate_time(time):
	return bool(re.match('^[0-1]?[0-9]:[0-5][0-9]$|^2[0-3]:[0-5][0-9]$', time))


def validate_time(time):
	import re
	return bool(re.search('^((0\\d)|(\\d)|(1\\d)|(2[0-3])):((0[0-9])|([0-5][0-9]))$', time))


import re

def validate_time(time):
	return bool(re.findall('^([01]?[0-9]|2[0-3]):[0-5][0-9]$', time))


import re
validate_time = lambda s: bool(re.match('([01]?\\d|2[0-3]):[0-5]\\d$', s))


import re

def validate_time(time):
	pattern = re.compile('^[012]?((?<=2)[0-3]|(?<!2)[0-9]):[0-5][0-9]$')
	return bool(re.fullmatch(pattern, time))