我有一个很大的字符串(一个 SQL 查询..),我已经在 notepad2 中写出来了。我正在使用 Java,我只是想知道是否有一种快速简便的方法可以在每行的末尾添加一些内容?例如:
String query = ""
+ " select column1
+ " , column2
+ " , column3
+ " from table
);
//want to add \n" at the end of each line
最佳答案
查找:(.)$
替换:\1\\n"
Here's一个很好的正则表达式教程。
关于regex - 使用正则表达式 notepad2 将字符添加到字符串的末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17553390/