I'm trying to match a route that has the keywords -episode or -movie.
Such as /steins-gate-episode-1 or /pokemon-movie-10
I tried doing this:
$app->get('/{slug:episode|movie}', \App\Controller\EpisodeController::class . ':getBySlug');
But it isn't matching.
Any help would be appreciated. I am completely new to this btw.
Your regular expression matches only the exact strings "episode" and "movie". If you want to check if the URL contains the substrings, you can use this:
.*
means "any number of any character" . Sure are there more advanced regexp patterns but that will do what you need.