我需要捕獲像所有字符串(\ W \ S),具有3的最小長度,用一個Python正則表達式的findall方法。這是:找到儘可能多的「字」(子字符串)儘可能,它是由至少3個連接組成的。 例如,對於: This is an e x a m p l e about T H I S question.
的findall應該返回: \S\S+(\w\s+){3,}\S+
我試圖使用正則表達式匹配以下字符串中的圖案重複的正則表達式 字符串: These are my variables -abc $def -geh $ijk for case1
These are my variables -lmn $opq -rst $uvw for case2
模式: These\s+are\s+my\s+variables(?:\s*-(\w+)\s+\$(\w+))