正则表达式,匹配前面不包含某个字符的字符串

2025-05-13 23:24:59
推荐回答(1个)
回答(1):

rex = r'[^abcde]*'re.match(rex, 'this is a string')返回值是None则不匹配,反之匹配 当然先compile一下也很好。