# What does \\s\* means?

**URL:** <https://www.ruby-forum.com/t/what-does-s-means/180233>\
**Category:** Ruby\
**Created:** [December 15, 2009, 9:57am UTC](https://www.ruby-forum.com/t/what-does-s-means/180233 "2009-12-15T09:57:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgovinda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c68b51/32.png) [@kgovinda](https://www.ruby-forum.com/u/kgovinda)\
**Post date:** [December 15, 2009, 9:57am UTC](https://www.ruby-forum.com/t/what-does-s-means/180233/1 "2009-12-15T09:57:23Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![kgovinda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c68b51/32.png) [@kgovinda](https://www.ruby-forum.com/u/kgovinda)\
**Post date:** [December 15, 2009, 10:27am UTC](https://www.ruby-forum.com/t/what-does-s-means/180233/2 "2009-12-15T10:27:20Z")

</div>

\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 whenever a dot followed by zero or more white spaces is  
encounterd.

Regards,  
Raghav

---

<div class="post-metadata">

**Author:** ![kgovinda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c68b51/32.png) [@kgovinda](https://www.ruby-forum.com/u/kgovinda)\
**Post date:** [December 15, 2009, 10:43am UTC](https://www.ruby-forum.com/t/what-does-s-means/180233/3 "2009-12-15T10:43:08Z")

</div>

griffith Khana wrote:

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

it’s actually ‘.\s\*’ =\> match a ‘.’ followed by zero or more spaces

read the regular-expression section for more details:

[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut\_stdtypes.html](http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_stdtypes.html)

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

–  
Kind Regards,  
Rajinder Y.

[http://DevMentor.org](http://DevMentor.org)

Do Good! - Share Freely
