Skip to content

how to get named keys with a negative look ahead? #252

@daniellizik

Description

@daniellizik

say i have a request with a url

/foo/123

how can I match anything except "foo" while having the first parameter be a named key?

// in js
/(?!foo).+/[0-9]+
// also need the first param, but this is invalid
/(?!foo):animal/:num
/dog/123       => match { animal: 'dog', num: 123 }
/cat/7893434   => match { animal: 'cat', num: 7893434 }
/foo/123       => no match { animal: null }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions