记事本++替换空间和,用,

ame*_*ope 7 regex notepad++

我对notepad ++中的替换选项完全不好,但是我使用它来编辑我的txt文件和一些txt格式的kindle书籍.

问题是,在某些方面我遇到了这个问题:

艾米丽是一个漂亮的女孩,但没有人真的喜欢她.

我真的很高兴有人可以帮助我替换这个空间 - 换行 - 来吧所以文字看起来像这样

艾米丽是一个漂亮的女孩,但没有人真的喜欢她.

谢谢!

hwn*_*wnd 6

您可以在此处执行的另一个选项是使用否定前瞻.

Find: \s+(?![^,])
Replace: 
Run Code Online (Sandbox Code Playgroud)

正则表达式:

\s+            whitespace (\n, \r, \t, \f, and " ") (1 or more times)
 (?!           look ahead to see if there is not:
  [^,]         any character except: ','
 )             end of look-ahead
Run Code Online (Sandbox Code Playgroud)

或者预测是否没有单词字符.

Find: \s+(?!\w)
Replace:
Run Code Online (Sandbox Code Playgroud)

正则表达式:

\s+            whitespace (\n, \r, \t, \f, and " ") (1 or more times)
 (?!           look ahead to see if there is not:
  \w           word characters (a-z, A-Z, 0-9, _)
 )             end of look-ahead
Run Code Online (Sandbox Code Playgroud)

您还可以在此处使用正向前瞻以查看是否存在非单词字符.

Find: \s+(?=\W)
Replace: 
Run Code Online (Sandbox Code Playgroud)