General questions about using TextPad
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
terrypin
- Posts: 172
- Joined: Wed Jul 11, 2007 7:50 am
Post
by terrypin »
I'm struggling to specify regex that will remove all strings of two or more spaces please?
For example, I want this:
Code: Select all
The quick brown fox jumped... over the lazy dog.
And another line here.
to become this:
Code: Select all
The quick brown fox jumped...over the lazy dog.
And another line here.
Terry
-
terrypin
- Posts: 172
- Joined: Wed Jul 11, 2007 7:50 am
Post
by terrypin »
OK, it came to me a few minutes later thanks. I hope this is correct?
Find
([^ ])([ ]+)
and replace with
\1
(That's \1 plus a space.)
-
ben_josephs
- Posts: 2457
- Joined: Sun Mar 02, 2003 9:22 pm
Post
by ben_josephs »
Your regex matches the non-space character preceding the spaces, and replacing it with itself. Is there a particular reason you are doing this?
This is simpler:
Find what: _+
Replace with: _
[Replace the underscores with spaces]
-
terrypin
- Posts: 172
- Joined: Wed Jul 11, 2007 7:50 am
Post
by terrypin »
Thanks, that is indeed much simpler!