I want to say that Napp Granade
serves in the spirit of a town in our dis-
trict of Georgia called Andersonville.
我有数以千计的文本文件,上面的数据和文字已经包装使用连字符和换行。在
我要做的是删除连字符并将换行符放在单词的末尾。我不想删除所有连字符的单词,如果可能的话,只删除行尾的单词。在
^{pr2}$上面的代码不工作,我尝试了几种不同的方法。在
我想浏览整个文本文件并删除所有表示换行符的连字符。例如:
I want to say that Napp Granade
serves in the spirit of a town in our district
of Georgia called Andersonville.
任何帮助都将不胜感激。在
您不需要使用正则表达式:
但你可以,当然,而且时间更短:
^{pr2}$我们寻找
-
后跟\n
,并捕获下面的单词,这是拆分单词的结尾。我们将所有这些替换为捕获的单词后跟一个新行。在
为了正确解释
\1
,不要忘记使用原始字符串进行替换。在相关问题 更多 >
编程相关推荐