Fixes issue #2692: Generator places new routes in the wrong location if the router has been reopened

Regex match and replace function has been modified so that new routes are placed at the top of the Router.map(), which eliminates the possibility of potentially valid code or useful comments breaking the functionality of the generate command.