The routing system that drupal 8 offers is flexible in terms of validation. It is possible to validate your route against some typical regex lines.
In the following mymodule.routing.yml yaml file, the {id} url parameter will be matched against the '\d+' regex, meaning a numeric character.
/path/test/1 will be valid
/path/test/test will be 'page not found'
mymodule.controller:
path: '/path/{method}/{id}'
defaults:
_controller: '\Drupal\mymodule\Controller\mymoduleSaveController::Render'
_title_callback: '\Drupal\mymodule\Controller\mymoduleSaveController::getTitle'
requirements:
_access: 'TRUE'
id: '\d+'