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.
Example 1
{id}
placeholder should be 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+'
Example 2
{name}
placeholder should string and contains only uppercase and lowercase alphabet.
/example/test will be valid
/example/100 will be 'page not found'
example.user
path: '/example/{name}'
defaults:
_controller: '\Drupal\example\Controller\ExampleController::content'
requirements:
_permission: 'access content'
name: '[a-zA-Z]+'