标签: python regex
我正在寻找一个python正则表达式,它匹配一个字符串前的3个单词的句子。
re.match(r'(\d\w+\d){3}test', "this is the test")
认为上述句子可行,但无效。
答案 0 :(得分:0)
(\b){3}test
(\w+\s+){3}test
(\w+\s+){3}\w?test
(\w+\s+){3}\w?test$