這裏真的很綠。我試圖得到一個在Notepad ++中使用BlueJ運行在Java中的正則表達式,但是Java似乎忽略了它。我正在使用其他replaceAll函數使用正則表達式,並且所有這些都在工作。Java正在忽略使用BlueJ去除重複行的正則表達式
我有這個,但它告訴我\ s是一個非法的轉義字符:
itemList[i] = itemList[i].replaceAll("^(\s*\r\n){2,}", "\r\n");
我讀到的Java引擎,改變了\ s到\ S所以並不違法:
itemList[i] = itemList[i].replaceAll("^(\\s*\r\n){2,}", "\r\n");
我嘗試使用[[:空間:]代替,但是,它仍然沒有做替換功能。
itemList[i] = itemList[i].replaceAll("^([[:space:]]*\r\n){2,}", "\r\n");
這個Java工具正在處理數百行代碼,並且人們在使用Notepad ++刪除重複行時遇到了問題。我想可能在格式化工具中這樣做會消除這些問題。這裏是文字的例子:
1. Modification: No Error Message When SQL Server Down
S9# 395
Summary
No error message when the SQL Server is
down.
Workaround
There is currently no
workaround for this issue. The system will become
unusable if SQL server is down.
我發現了一個類似的線程,可以幫助您.http://stackoverflow.com/questions/1573361/find-duplicate-lines-and-remove-using-regular-expression-with-replace-feature – lsiva
謝謝。我正在閱讀它。 – PatrickD