Page 1 of 1
Delete repetitive spaces
Posted: 2011-10-27 01:42:08
by NisusUser
Well, this must be a real Newbie question. I have a text with sometimes two or more white spaces where only one should be. I cannot get any of the three ways of doing search and replace in NWP (1.4.2) to replace them. I was used to Word (Win) where you just type in spaces in the find box and then the number of spaces you want to replace them with in the replace box, and it works. For whatever reason, that doesn't work (for me at least) in NWP.
Re: Delete repetitive spaces
Posted: 2011-10-27 04:14:29
by Groucho
Hi, NisusUser
Open Find/Replace. Select
PowerFind Pro from the
Using: pop-up. In the
Find What field type the following:
(Note: hit the spacebar twice and then type a plus sign.)
In the
Replace With field type:
(Hit the spacebar once.)
Any trouble let me know.
Cheers, Henry.
Re: Delete repetitive spaces
Posted: 2011-10-27 09:17:19
by martin
NisusUser wrote:I was used to Word (Win) where you just type in spaces in the find box and then the number of spaces you want to replace them with in the replace box, and it works. For whatever reason, that doesn't work (for me at least) in NWP.
This should work in NWP just fine, eg: if you type two spaces into the "find what" field, one space into the "replace with" field, and click "Replace All", that will collapse all two space sequences in your document to a single space.
Perhaps you have some exotic spaces in your document (eg: a thin space)? If so, you could use a PowerFind expression like this:

- replace.png (16.72 KiB) Viewed 5665 times
You can insert those bubbles using the little "gear icon" button next to the "find what" field. From that button, use the menus
Wild Card > Any Space and
Repeat > 1+. Once you have the (AnySpace)(1+) expression, just type a single space into the "replace with" field, and then click "Replace All" to zap all spaces in your document.
If you still have trouble, let us know.
Re: Delete repetitive spaces
Posted: 2011-10-27 09:27:49
by NisusUser
Thank you both, Henry and Martin. I'll try both ways. I think, Martin, that I did what you said except that I didn't know about the 1+ gizmo. I can't look at it today, but maybe tomorrow. Thanks again!
Re: Delete repetitive spaces
Posted: 2011-10-27 09:35:37
by Groucho
Alternatively, you can use this macro. It affects a selected text, if any. If there is no selection, the whole document is fixed.
Henry.
Re: Delete repetitive spaces
Posted: 2011-10-27 12:01:27
by martin
Thanks for the macro Henry.
NisusUser wrote:I think, Martin, that I did what you said except that I didn't know about the 1+ gizmo. I can't look at it today, but maybe tomorrow. Thanks again!
Sure thing.
The "1+" bubble is just the PowerFind way of saying "match one or more of the thing that comes just before". In this case, match one or more of the "Any Space" bubble. But you don't need need to get fancy with PowerFind if you don't want to. You could just type in two regular spaces and replace them with a single space.