Advanced Route Matching
Learn advanced patterns for route matching in NEMO
Advanced Route Matching
NEMO provides powerful route matching capabilities that go beyond simple path matching. This guide covers advanced techniques for fine-tuning your route patterns.
Parameter Constraints
Matching Specific Values
You can constrain route parameters to match only a specific set of values using the (option1|option2)
syntax:
This route will match:
/en/documentation
/fr/documentation
/es/documentation
But will NOT match:
/de/documentation
/jp/documentation
Excluding Specific Values
You can exclude specific values from matching by using the !
operator in the constraint:
This route will match:
/products/details
/users/details
/settings/details
But will NOT match:
/api/details
Combining Multiple Constraints
You can use multiple parameter constraints within a single route:
Examples
Language-specific Routes
Protected Routes Exclusion
Using Regular Expressions
For even more complex matching requirements, NEMO supports full regular expressions within parameter constraints: