Notepad ++ replace the space and, with,

I am completely mistaken when replacing an option in Notepad ++, but I use it to edit txt files and some books for my Kindle in txt format.

The problem is that on some lines I have this problem:

Example

Emily was a beautiful girl, but she did not like anyone.

I would be very believable if someone can help me replace this space-new line - it will come so that the text will look like this

Emily was a beautiful girl, but she did not like anyone.

Thanks!

+6
source share
3 answers

Try replacing this regex:

\s+, 

Wherein:

 , 
+11
source

Another option you can do here is Negative Lookahead .

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

Regular expression:

 \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 

Or look for word characters.

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

Regular expression:

 \s+ whitespace (\n, \r, \t, \f, and " ") (1 or more times) (?! look ahead to see if there is not: \w word characters (az, AZ, 0-9, _) ) end of look-ahead 

You can also use Positive Lookahead to see if there are characters other than words.

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

In addition to ProgramFox's answer, I would add this link, this may help you for further regex, including this space:

http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Regular_Expressions

thanks

0
source

Source: https://habr.com/ru/post/956785/


All Articles