Match a URL with placeholders with a URL with filled placeholders

Discussão em 'Angular' iniciado por mentalo, Setembro 16, 2025.

  1. mentalo

    mentalo Guest

    I am trying to match two URLs, one with placeholders and one with filled placeholders in Angular with TypeScript.

    For Example

    URL before the placeholders are filled:

    http://this/is/{placeholder1}/{placeholder2}/my/url?limit=10&offset=5


    URL after the placeholders are filled:

    http://this/is/100Banana/200Apple/my/url?limit=10&offset=5


    The target is to match those two URLs with Regex and get a match. One of the problems is, that the placeholders could be filled with anything a URL allows.

    The first attemp was to replace the placeholders with Regex like [^/]+ before the Regex match. But that only works if the placeholders were at the end of the URL.

    Continue reading...

Compartilhe esta Página