# Strings

**URL:** <https://www.ruby-forum.com/t/strings/136439>\
**Category:** Ruby\
**Created:** [May 2, 2008, 4:29am UTC](https://www.ruby-forum.com/t/strings/136439 "2008-05-02T04:29:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [May 2, 2008, 4:29am UTC](https://www.ruby-forum.com/t/strings/136439/1 "2008-05-02T04:29:29Z")

</div>

Could someone help me convert a string with a number in it such as “26.7  
feet” to just the word, “feet”?

I’ve searched documentation without luck. Thank you!

---

<div class="post-metadata">

**Author:** ![leveille](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a88e57/32.png) [@leveille](https://www.ruby-forum.com/u/leveille)\
**Post date:** [May 2, 2008, 4:35am UTC](https://www.ruby-forum.com/t/strings/136439/2 "2008-05-02T04:35:40Z")

</div>

Hi –

On Fri, 2 May 2008, Jason L. wrote:

> Could someone help me convert a string with a number in it such as “26.7  
> feet” to just the word, “feet”?
> 
> I’ve searched documentation without luck. Thank you!

string[/\w+$/] would give you “feet”. A lot depends on how you define  
the operation you want (last sequence of characters, everything after  
last number, etc.).

David
