Can you apply a regular expression for a param? #488
Unanswered
yuliankarapetkov
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I currently have a route which I have configured to be
(foo|bar)
. So now my child route of example accepts the following combinations:However, when I navigate to my example page,
$page.path
is/(foo|bar)/example
so I'm not able to tell if the first param isfoo
orbar
unless I checklocation.pathname
.On the other hand, if I rename my directory to be called
[myParam]
instead of(foo|bar)
, all types of strings would match this route, like:So what directory name should I use to create a param called
myParam
that satisfies the regular expression(foo|bar)
?StackOverflow link: click
Beta Was this translation helpful? Give feedback.
All reactions