これでいけるっぽい。
import reresult = ""input_tel1 = "03-1111-2222"input_tel2 = "03-452-22234"def check(tel):if re.match('[0-9]{2}-[0-9]{4}-[0-9]{4}', tel):return "OK"else:return "NG"print("input_tel1{0}".format(check(input_tel1)))print("input_tel2{0}".format(check(input_tel2)))
≪引用元≫