使用python来做正则表达式:
import re
txt = "teg erwe df 23"
#Check if the string has any characters between a and n:
x = re.findall("[a-n]", txt)
print('[a-n] 结果:',x)
if x:
print("Yes, there is at least one match for characters between a and n!")
else:
print("No match")
y = re.findall("[o-z]", txt)
print('[o-z] 结果:',y)
字符 [a-n]: Returns a match for any lower case character, alphabetically between a and n
结果如下:
如果觉得不错,就点赞或者关注或者留言~
谢谢~