nisus.com
https://www.nisus.com/forum/

\s and \n
https://www.nisus.com/forum/viewtopic.php?f=17&t=4370
Page 1 of 1

Author:  Matze [ 2011-06-28 02:03:32 ]
Post subject:  \s and \n

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

Author:  martin [ 2011-06-28 09:16:02 ]
Post subject:  Re: \s and \n

Matze wrote:
So does this mean I have to write something else in the replace part, to make NWP replace something with a space??

Yes, you can just type in a normal space. No special code/escape is required.
Quote:
And does this mean, that \s is not only a space but a return as well?

That's correct. In regular expressions "\s" stands for any whitespace, and includes spaces, newlines, tabs, half-width spaces, etc.

Author:  Matze [ 2011-06-28 23:40:18 ]
Post subject:  Re: \s and \n

Okay, I understand, is there an expression like \s in old NW only for spaces?

Author:  martin [ 2011-06-28 23:44:04 ]
Post subject:  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".

Author:  macduffee [ 2011-07-01 12:23:45 ]
Post subject:  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.

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/