You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
354 B

# 可视化正则表达式生成器
# https://www.wangwl.net/static/projects/visualRegex
import re
if __name__ == '__main__':
# 是否匹配指定的正则表达式
r = r'(\w*)(\w*元/年)\w*'
str = r'asdfsdf(123元/年)sdfsdf'
m = re.search(r, str)
if m:
print("yes")
print(m.group(1))
else:
print("no")