这里真的很绿。我试图得到一个在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