【发布时间】:2012-05-14 22:29:16
【问题描述】:
假设我用光标选择了如下文本:
This is a test.
This
is a test.
This is a test.
This is a
test.
我想把它改成:
This is a test. This is a test
This is a test. This is a test
换句话说,我想用空格替换单个换行符,留下空行。
我认为类似以下的方法会起作用:
RemoveSingleLineBreaks()
{
ClipSaved := ClipboardAll
Clipboard =
send ^c
Clipboard := RegExReplace(Clipboard, "([^(\R)])(\R)([^(\R)])", "$1$3")
send ^v
Clipboard := ClipSaved
ClipSaved =
}
但事实并非如此。如果我将它应用于上面的文本,它会产生:
This is a test. This is a test.
This is a test. This is a test.
这也删除了中间的“空行”。这不是我想要的。
澄清一下:空行是指任何带有“白色”字符(例如制表符或空格)的行
有什么想法吗?
【问题讨论】:
标签: regex autohotkey