题解 | #字符串通配符#
字符串通配符
https://www.nowcoder.com/practice/43072d50a6eb44d2a6c816a283b02036
import re while True: try: s = input().lower() target = input().lower() pattern = s.replace(".","\.").replace("*","[0-9a-z]*").replace("?","[0-9a-z]") res = re.findall(pattern,target) # res = re.findall(pattern, target, flages = re.I) # re.I 匹配时不区分大小写 if target in res: print("true") else: print("false") except: break