I have a route "/api/books/{id}/status" and I am wondering how can I evaluate a dynamic value ("{id}") by using regular expression, so I could restrict this route in my .htaccess file?
I'm sure what you're up to. But to evaluate dynamic values in URL you have to use regular expressions. This has nothing to do with symfony. Apache mod_rewrite Introduction
RewriteCond %{REQUEST_URI} api/books/[\d]+/status
If you want to restrict access to routes, you should use the security component of symfony.