Answers.Body: <p>You forgot to escape the dot, but otherwise it looks good to me.</p>
  
  <p>You could replace <code>[a-zA-Z0-9._%-]</code> with <code>.</code> to allow all characters in the slug. Maybe you want to use german umlauts or other special characters in your slugs at some point (you probably shouldn't, but who knows). I'd do that (the <code>.</code>, not the umlauts), as I think it's not the task of a route to restrict you in doing such things.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-29T16:27:51.727Z
Answers.LastActivityDate: 2014-07-29T16:33:35.027Z
Answers.LastEditDate: 2014-07-29T16:33:35.027Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>The simplest way to transform <a href="http://buildwithcraft.com/docs/routing#dynamic-routes">dynamic routes</a> into <a href="http://buildwithcraft.com/docs/routing#advanced-routing">advanced routes</a>, is to go to your <code>craft_routes</code> table and copy it out of <code>urlPattern</code>:</p>
  
  <p><strong>Example:</strong></p>
  
  <p>If you have set this in your backend:<br>
  <code>news-sort/month/&lt;year&gt;/&lt;month&gt;</code></p>
  
  <p>You'll find this in <code>urlPattern</code>:<br>
  <code>news\-sort\/month\/(?P&lt;year&gt;\d{4})\/(?P&lt;month&gt;(?:0?[1-9]|1[012]))</code></p>
  
  <p>Just remove the escaping <code>\</code>, and you've got your regex:<br>
  <code>news-sort/month/(?P&lt;year&gt;\d{4})/(?P&lt;month&gt;(?:0?[1-9]|1[012]))</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-29T17:41:01.587Z
Answers.Text: great idea, I never thought of that!
Answers.UserDisplayName: mjr
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-29T19:48:41.970Z
Answers.Text: awesome answer!
Answers.UserDisplayName: Seán O'Grady
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-29T16:39:33.260Z
Answers.LastActivityDate: 2014-07-29T16:39:33.260Z
Answers.UserDisplayName: Victor
Body: <p>I want to move some permanent routes from the admin to my routes config file so that they can be version controlled.</p>
  
  <pre><code>in the admin...
  news-sort/month/&lt;year&gt;/&lt;month&gt; ....
  news-sort/tag/&lt;tag&gt; ....
  news-sort/author/&lt;*&gt;
  </code></pre>
  
  <p>Do these look ok, not 100% sure on the variable and regex etc.</p>
  
  <pre><code>'news-sort/month/(?P&lt;year&gt;\d{4})/(?P&lt;month&gt;\d{2})' =&gt; 'news-sort/index',
  'news-sort/tag/(?P&lt;tag&gt;[a-zA-Z0-9._%-]+)' =&gt; 'news-sort/index',
  'news-sort/author/(?P&lt;author&gt;[a-zA-Z0-9._%-]+)' =&gt; 'news-sort/index'
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-29T16:07:55.493Z
Comments.Text: Do they work, mjr?
Comments.UserDisplayName: carlcs
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2014-07-29T17:42:08.573Z
Comments.Text: I tested one and it seems to work ok
Comments.UserDisplayName: mjr
Tags: <config><routes>
Title: `routes.php` config example
ThreadText: # `routes.php` config example
  
  (Asked by: username_0 on 2014-07-29)
  
  I want to move some permanent routes from the admin to my routes config file so that they can be version controlled.
  
  ```
  in the admin...
  news-sort/month/<year>/<month> ....
  news-sort/tag/<tag> ....
  news-sort/author/<*>
  
  ```
  
  Do these look ok, not 100% sure on the variable and regex etc.
  
  ```
  'news-sort/month/(?P<year>\d{4})/(?P<month>\d{2})' => 'news-sort/index',
  'news-sort/tag/(?P<tag>[a-zA-Z0-9._%-]+)' => 'news-sort/index',
  'news-sort/author/(?P<author>[a-zA-Z0-9._%-]+)' => 'news-sort/index'
  
  ```
  
  **Tags:** config, routes
  
  > **Comments:**
  > **username_1**: Do they work, mjr?  
  > **username_0**: I tested one and it seems to work ok  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-07-29. Score: 9 | Accepted answer
  
  The simplest way to transform [dynamic routes](http://buildwithcraft.com/docs/routing#dynamic-routes) into [advanced routes](http://buildwithcraft.com/docs/routing#advanced-routing), is to go to your `craft_routes` table and copy it out of `urlPattern`:
  
  **Example:**
  
  If you have set this in your backend:  
  `news-sort/month/<year>/<month>`
  
  You'll find this in `urlPattern`:  
  `news\-sort\/month\/(?P<year>\d{4})\/(?P<month>(?:0?[1-9]|1[012]))`
  
  Just remove the escaping `\`, and you've got your regex:  
  `news-sort/month/(?P<year>\d{4})/(?P<month>(?:0?[1-9]|1[012]))`
  
  > **Comments:**
  > **username_0**: great idea, I never thought of that!  
  > **username_3**: awesome answer!  
  
  ---
  
  ### Answer by username_1 on 2014-07-29. Score: 3
  
  You forgot to escape the dot, but otherwise it looks good to me.
  
  You could replace `[a-zA-Z0-9._%-]` with `.` to allow all characters in the slug. Maybe you want to use german umlauts or other special characters in your slugs at some point (you probably shouldn't, but who knows). I'd do that (the `.`, not the umlauts), as I think it's not the task of a route to restrict you in doing such things.
  
  
  ---
  
  