我已經(jīng)從 Youtube 中提取了一些 cc,但我被下面的值困住了,我不知道如何處理它。我擅長替換字符串和其他東西,但是當(dāng)事情變得嚴(yán)重時(shí)我真的很糟糕:(這個(gè) we all have a unique perspective on the we all have a unique perspective on the we all have a unique perspective on the world around us and believe it or not world around us and believe it or not world around us and believe it or not應(yīng)替換為:we all have a unique perspective on theworld around us and believe it or not
1 回答

慕俠2389804
TA貢獻(xiàn)1719條經(jīng)驗(yàn) 獲得超6個(gè)贊
使用這個(gè)正則表達(dá)式,你可以去掉所有只有一個(gè)單詞的行,如果有多個(gè)單詞的行并且完全重復(fù),它們將被替換為單行,
\w+\s*\n|([\w ]+)\n*(\1\n+)*
這里交替\w+\s*\n
中的第一部分匹配單個(gè)字行并用空字符串替換,第二次交替([\w ]+)\n*(\1\n+)*
捕獲 group1 中的一行,然后(\1\n+)*
消耗任何重復(fù)的行,最后由 group2 替換,group2 是同一行重復(fù)多次。
添加回答
舉報(bào)
0/150
提交
取消