2013-10-26 53 views
5

我完全不好,用記事本++中的替換選項,但我用它來編輯我的txt文件和一些我的kindle在txt格式的書。記事本++替換空間,並與,

的問題是,在一些線路我已經得到了這個問題:

例如

艾米麗是一個漂亮的女孩 ,但沒有人真的很喜歡她。

我是真的greatfull是有人能幫我更換這個空間換行符上門來,讓文本看起來像這樣

艾米麗是個漂亮的女孩,但沒有人真的很喜歡她。

謝謝!

回答

11

嘗試更換此正則表達式:

\s+, 

有了這個:

, 
+2

這工作得很好!你是我的英雄! – amefromdope

5

您可以在此處執行的另一個選擇是使用負面預測

Find: \s+(?![^,]) 
Replace: 

正則表達式:

\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 

還是向前看,看看是否有沒有字字符。

Find: \s+(?!\w) 
Replace: 

正則表達式:

\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 

你也可以使用一個正先行這裏查看,看是否有非單詞字符。

Find: \s+(?=\W) 
Replace: