# Valid HK Phone Number

## Overview

In Hong Kong, a valid phone number has the format ```xxxx xxxx``` where ```x``` is a decimal digit (0-9).  For example:

## Task

Define two functions, ```isValidHKPhoneNumber``` and ```hasValidHKPhoneNumber```, that ```return```s whether a given string is a valid HK phone number and contains a valid HK phone number respectively (i.e. ```true/false``` values).

If in doubt please refer to the example tests.

Difficulty: EASY
Starter code: def is_valid_HK_phone_number(number):
	

Solutions:
import re
HK_PHONE_NUMBER = '\\d{4} \\d{4}'

def is_valid_HK_phone_number(number):
	return bool(re.match(HK_PHONE_NUMBER + '\\Z', number))

def has_valid_HK_phone_number(number):
	return bool(re.search(HK_PHONE_NUMBER, number))


from re import match, search
is_valid_HK_phone_number = lambda n: match('^\\d{4} \\d{4}$', n) is not None
has_valid_HK_phone_number = lambda n: search('\\d{4} \\d{4}', n) is not None


from re import match, search

def is_valid_HK_phone_number(number):
	return bool(match('\\d{4}\\s\\d{4}\\Z', number))

def has_valid_HK_phone_number(number):
	return bool(search('\\d{4}\\s\\d{4}', number))


import re

def is_valid_HK_phone_number(number):
	return bool(re.search('^\\d{4} \\d{4}$', number))

def has_valid_HK_phone_number(number):
	return bool(re.search('\\d{4} \\d{4}', number))


import re
VALID_PHONE = re.compile('\\d{4} \\d{4}')

def is_valid_HK_phone_number(number):
	return len(number) == 9 and bool(VALID_PHONE.match(number))

def has_valid_HK_phone_number(number):
	return bool(VALID_PHONE.search(number))


import re

def is_valid_HK_phone_number(number):
	return len(number) == 9 and has_valid_HK_phone_number(number)

def has_valid_HK_phone_number(number):
	return bool(re.search('\\d{4}\\s\\d{4}', number))


import re
IS_VALID = re.compile('\\d{4} \\d{4}\\Z')
HAS_VALID = re.compile('\\d{4} \\d{4}')

def is_valid_HK_phone_number(number):
	return bool(IS_VALID.match(number))

def has_valid_HK_phone_number(number):
	return bool(HAS_VALID.search(number))


import re
full_number_regex = re.compile('^\\d{4} \\d{4}$')
part_number_regex = re.compile('\\d{4} \\d{4}')

def is_valid_HK_phone_number(number):
	return full_number_regex.match(number) is not None

def has_valid_HK_phone_number(number):
	return part_number_regex.search(number) is not None