我在Python中尝试了一些正则表达式匹配。例如:
s = "aaabbb123123"
print(re.search("[ab]*",s))
output : <re.Match object; span=(0,6),match='aaabbb'> --> Ok,it's good.
s = "aaabbb123123"
print(re.search("[.]*",0),match=''> --> why not "aaabbb123123"?
s = "aaabbb123123"
print(re.search("[123]*",match=''> --> why not "123123"?
我的问题是,如果匹配的字符串不在目标字符串的起始位置,为什么模式[[anything] *”不起作用。