# Rails routes and regex

**URL:** <https://www.ruby-forum.com/t/rails-routes-and-regex/186821>\
**Category:** Rails\
**Created:** [April 13, 2010, 1:40am UTC](https://www.ruby-forum.com/t/rails-routes-and-regex/186821 "2010-04-13T01:40:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [April 13, 2010, 1:40am UTC](https://www.ruby-forum.com/t/rails-routes-and-regex/186821/1 "2010-04-13T01:40:44Z")

</div>

We have an api set up where the version will change is there a way to  
map the :controller part to take that part into account and not have  
to map v1 v2…

map.connect ‘api/:v/:controller/:action’, :controller =\>  
‘api/:v/:controller’, :v =\> /v\d+/

Can I use :v in both sections or just the first part?
