Skip to content

Do not match certain words as parameters with path-to-regexp #268

@Milutin-P

Description

@Milutin-P

I have a route /:parameter and if someone pings that route I should serve him certain page (React App)
So what I need is some kind of regexp that wont match certain words...

Regular expression should be ^(?!.*(foobar1|\/foobar2)).*$

https://pshrmn.github.io/route-tester/#/ I've used this tool for testing and entered various combinations, such as /parameter(?!.*(foobar1|\/foobar2)) but no luck...

So test case should be

if path is /foobar3 it should return page
if path is /foobar2 or /foobar3 it should return null

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions