正則表達式匹配連續出現的單詞

有個需求:在編輯器上,當用戶輸入 "hello world world",或者」好的的「,明顯是多輸入了,這時候但願把這種狀況給檢查出來,使用正則表達式能夠達到這個要求。正則表達式 String p2 = "(\\s*|\\s*\\S+\\s+)([A-Za-z]+)\\s+\\2";編輯器 boolean isMatch = Pattern.matches(p, "hello world wor
相關文章
相關標籤/搜索