# Non-greedy matching in routes?

**URL:** <https://www.ruby-forum.com/t/non-greedy-matching-in-routes/195381>\
**Category:** Rails\
**Created:** [September 22, 2010, 1:25pm UTC](https://www.ruby-forum.com/t/non-greedy-matching-in-routes/195381 "2010-09-22T13:25:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mksys](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@mksys](https://www.ruby-forum.com/u/mksys)\
**Post date:** [September 22, 2010, 1:25pm UTC](https://www.ruby-forum.com/t/non-greedy-matching-in-routes/195381/1 "2010-09-22T13:25:43Z")

</div>

I am trying to create a route in Rails 3 that matching a url that  
consists of a country region and the title of the story.

So a url would look something like this:  
[http://www.website.com/gb-this-is-the-title-of-the-story](http://www.website.com/gb-this-is-the-title-of-the-story)

I created the following route:

match ‘/:region-:story’ =\> ‘story#show’, :as =\> :show

but in the above example I see in the server log it is matching it  
like so:

Parameters: {“region”=\>“gb-this-is-the-title-of-the”,  
“story”=\>“story”}

How would you set this to use a non-greedy match on the hyphen so that  
region will be “gb”?

Thanks in advance!  
Mark
