what does \s* means?

G

griffith Khana

what does the .\s* means in the following commad






class String
def sentences
gsub(/\n|\r/, ' ').split(/\.\s*/)
end
end
 
D

Dasson, Raghav

\s* means occurrence of zero or more white spaces.

gsub(/\n|\r/, ' ').split(/\.\s*/) is basically first removing all the line=
feeds and carriage returns and then the sentence is split into an array wh=
enever a dot followed by zero or more white spaces is encounterd.

Regards,
Raghav=20

-----Original Message-----
From: (e-mail address removed) [mailto:[email protected]]=20
Sent: Tuesday, December 15, 2009 2:27 PM
To: ruby-talk ML
Subject: what does \s* means?




what does the .\s* means in the following commad






class String
def sentences
gsub(/\n|\r/, ' ').split(/\.\s*/)
end
end
--=20
Posted via http://www.ruby-forum.com/.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,841
Latest member
WilmerBelg

Latest Threads

Top