[Vuejs]-How to add in router vue.js one word exception in the path in one route?

0👍

If you try your path definition in express-route-tester (link found on Path-to-RegExp – library used by Vue Router to match routes) you will see it matches only one letter

  • you need to move + inside (/:identifier(\\b(?:(?!word)\\w+)\\b))
  • and still this will not match for example wordss

Result: /:identifier(\b(?:(?!word\b)\w+)\b)

But maybe you are trying to solve something with regex what can be solved different way ? Do you know the Vue Router takes routes in order ? So if you define two routes:

/word
/:id

First will take precedence…

Leave a comment