@tykus : I think it will, it's only regex.
So
-
[a-z]+ will not limit to 1
-
[a-z] should limit to 1 letter
-
[a-z]{2} - should be exactly 2 characters
But I haven't tested, so I will try soon to be sure of that :) // Edit : I just test it, it works great.
@Sonix : you can use global constraints if needed : https://laravel.com/docs/5.7/routing#parameters-regular-expression-constraints
You set some name for when you want only one letter, or a full name, or a number, etc. and you set it as a global constraint to use it and control the string in every route.
But with my solution, as you can set it for each route, I don't see where is your issue.
Route::get('/students/{alphabet}', 'PostController@showByAlphabet')->where('alphabet', '[a-z]');
Route::get('/students/{name}', 'PostController@showByName')->where('name', '[A-Za-z]+');;
Route::get('/students/{class}', 'PostController@showByClass')->where('class', '[A-Za-z]+');;