# Hyphens

**URL:** <https://www.ruby-forum.com/t/hyphens/93682>\
**Category:** Ruby\
**Created:** [April 6, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/hyphens/93682 "2006-04-06T12:17:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hpolat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c2a13f/32.png) [@hpolat](https://www.ruby-forum.com/u/hpolat)\
**Post date:** [April 6, 2006, 12:17pm UTC](https://www.ruby-forum.com/t/hyphens/93682/1 "2006-04-06T12:17:22Z")

</div>

how can I scan a string and chop it of to a words without losing the  
hyphens ?  
EG: apple $ two ( to be  
will be saved in the array  
as array = [‘apple’, ‘$’ , ‘two’, ‘(’ , ‘to’ , ‘be’]  
thank you

---

<div class="post-metadata">

**Author:** ![hpolat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c2a13f/32.png) [@hpolat](https://www.ruby-forum.com/u/hpolat)\
**Post date:** [April 6, 2006, 12:24pm UTC](https://www.ruby-forum.com/t/hyphens/93682/2 "2006-04-06T12:24:15Z")

</div>

> how can I scan a string and chop it of to a words without losing the  
> hyphens ?  
> EG: apple $ two ( to be  
> will be saved in the array  
> as array = [‘apple’, ‘$’ , ‘two’, ‘(’ , ‘to’ , ‘be’]  
> thank you

split?

‘apple $ two ( to be’.split
