Hi there,
I wanted to replace all double-spaces or more by one space and wrote Find '\s\s+' and Replace '\s' in the FR Window and hit replace all.
This 1. made NWP to replace doublespaces with the letter s.
And 2. it also replaced spaces followed by a return.
So does this mean I have to write something else in the replace part, to make NWP replace something with a space??
And does this mean, that \s is not only a space but a return as well?
Best Matze
\s and \n
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: \s and \n
Yes, you can just type in a normal space. No special code/escape is required.Matze wrote:So does this mean I have to write something else in the replace part, to make NWP replace something with a space??
That's correct. In regular expressions "\s" stands for any whitespace, and includes spaces, newlines, tabs, half-width spaces, etc.And does this mean, that \s is not only a space but a return as well?
Re: \s and \n
Okay, I understand, is there an expression like \s in old NW only for spaces?
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: \s and \n
There is no special symbolic escape for just a space, but you could use the character code escape, eg: "\x20" or "\u0020".
Re: \s and \n
This is good to know. I used the \s religiously in 6.5 myself. It only found spaces, not returns (\r) or tabs (\t). It's very hard to teach an old dog new tricks.