import re reg=r"ab+" m=re.search(reg,"acabc") print(m) reg=r"ab*" m=re.search(reg,"acabc")
import re reg=r"ab+" m=re.search(reg,"acabc") print(m) reg=r"ab*" m=re.search(reg,"acabc") print(m) 结果: <_sre.sre_match object; span="(2," 4), match="ab"> <_sre.sre_match object; span="(2," 4), match="ab">