Reply to topic  [ 5 posts ] 
\s and \n 
Author Message
User avatar

Joined: 2004-12-14 07:54:49
Posts: 156
Location: Düsseldorf Germany
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


2011-06-28 02:03:32
Profile WWW
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
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.


2011-06-28 09:16:02
Profile WWW
User avatar

Joined: 2004-12-14 07:54:49
Posts: 156
Location: Düsseldorf Germany
Okay, I understand, is there an expression like \s in old NW only for spaces?


2011-06-28 23:40:18
Profile WWW
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
There is no special symbolic escape for just a space, but you could use the character code escape, eg: "\x20" or "\u0020".


2011-06-28 23:44:04
Profile WWW

Joined: 2009-04-28 09:09:13
Posts: 15
Location: Minneapolis, MN
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.


2011-07-01 12:23:45
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software