题解 | #字符串通配符#
字符串通配符
https://www.nowcoder.com/practice/43072d50a6eb44d2a6c816a283b02036
import re rule=input().upper() pattern=re.sub("\*+","[A-Z0-9]*",rule) pattern=re.sub("\?","[A-Z0-9]",pattern) pattern="^"+pattern+"$" s=input().upper() match=re.match(pattern,s) print("true") if match else print("false")