Sublime Forum

Regex: How to Remove Empty Spaces between words that have splited and to let one single space between words?

#1

hello. I made a mistake, now all the characters from words have been split by a single space, and the words have been split by another space (that means 2 spaces).

M y M o t h e r i s v e r y b e a u t i f u l.

(The system see here only one space between words, but there are 2 spaces)

So, how can I remove with REGEX only the space between characters, and let one space between words?

I try this, but remove all space, not let any space between words ^[ \t]+|[ \t]+$

0 Likes

#2

 
This should work:

Find:   (•?)•
( substitute a   space   character in place of each     )

Replace:   $1
 



 

 
You can use code blocks for accurate whitespace representation ( except for trailing whitespace ).


M y  M o t h e r  i s  v e r y  b e a u t i f u l.  
3 Likes

#3

You can download Trimmer Package. It has ability to remove blank spaces in code.

0 Likes

#4

just use single space character «\s», replace it with empty charatcter (null)

0 Likes

#5

if I use \s will delete every space, and I will get something like this: MyMotherisverybeautiful.

0 Likes

#6

sorry 0;) try this:

  • find what: ([^\s])(\s)
  • replace with: $1
0 Likes

#7

works fine. Thanks

0 Likes