diff --git a/backbone.js b/backbone.js
index <HASH>..<HASH> 100644
--- a/backbone.js
+++ b/backbone.js
@@ -1292,7 +1292,7 @@
                      return optional ? match : '([^/?]+)';
                    })
                    .replace(splatParam, '([^?]*?)');
-      return new RegExp('^' + route + '(?:\\?(.*))?$');
+      return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
     },
 
     // Given a route, and a URL fragment that it matches, return the array of
diff --git a/test/router.js b/test/router.js
index <HASH>..<HASH> 100644
--- a/test/router.js
+++ b/test/router.js
@@ -788,7 +788,22 @@
         }
       }
     });
-    var router = new Router;
+    new Router;
+    Backbone.history.start({pushState: true});
+  });
+
+  test('newline in route', 1, function() {
+    location.replace('http://example.com/stuff%0Anonsense?param=foo%0Abar');
+    Backbone.history.stop();
+    Backbone.history = _.extend(new Backbone.History, {location: location});
+    var Router = Backbone.Router.extend({
+      routes: {
+        'stuff\nnonsense': function() {
+          ok(true);
+        }
+      }
+    });
+    new Router;
     Backbone.history.start({pushState: true});
   });
Handle newlines in route params.