title: Variables in Backbone.js routes: regex required?
body: <p>I'd like a Backbone routing setup that works as follows: </p>
  
  <ul>
  <li>routes like <code>/country/[any string]</code>, where <code>country</code> is either <code>us</code> or <code>ca</code>, should both go to <code>handleByCountry(country, location)</code></li>
  <li>any other route should redirect to <code>/</code> and be handled by <code>handleHome</code>.</li>
  </ul>
  
  <p>Currently I have (as a crude first attempt):</p>
  
  <pre><code>  var AppRouter = Backbone.Router.extend({
        routes: {
            "ca/:str": "handleByCountry",
            "us/:str": "handleByCountry",
            "*route": "home" 
        },
        handleByCountry: function(str){
            console.log('ROUTE handleByCountry', route); 
            // how to get the country? parse route by hand?
        },
        home: function(route){
            this.navigate('/');
        },
    });
  </code></pre>
  
  <p>This has the following problems: </p>
  
  <ul>
  <li>Not DRY - can I write a single route that matches both <code>ca</code> and <code>us</code>? I need some kind of conditional variable, maybe a regex.</li>
  <li>How can I check the current country from inside <code>handleByCountry</code>? Do I need to parse the route string again?</li>
  </ul>
  
  <p>Also, is forwarding other routes to <code>/</code>, as I am doing, good practice?</p>