programming-examples/python/Regular_Expression/Where a string will start with a specific number.py
2019-11-15 12:59:38 +01:00

9 lines
224 B
Python

import re
def match_num(string):
text = re.compile(r"^5")
if text.match(string):
return True
else:
return False
print(match_num('5-2345861'))
print(match_num('6-2345861'))