url-regex-safe icon indicating copy to clipboard operation
url-regex-safe copied to clipboard

Regex not matching URLS

Open NN-Binary opened this issue 4 years ago • 1 comments

Hi,

<img class="central-featured-logo" src="portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png" srcset="portal/wikipedia.org/assets/img/[email protected] 1.5x, portal/wikipedia.org/assets/img/[email protected] 2x" width="200" height="183" alt="Wikipedia">

(Wikipedia Homepage) Here the URL that is matched is wikipedia.org/assets/img/Wikipedia-logo-v2.png instead of portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png

        var matches = StringToMatch.match(urlRegexSafe({
            localhost: false,
            ipv4: false,
            ipv6: false
        }));

Am I doing something wrong or it's url-regex-safe that isn't doing proper match? Thanks for the help

NN-Binary avatar Jul 23 '21 10:07 NN-Binary

portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png is a path, not an URL. wikipedia.org/assets/img/Wikipedia-logo-v2.png isn't an url, too, but wikipedia.org looks like a domain, so this lib tries to make an URL out of it, I guess.

nicod-pc avatar Aug 11 '21 08:08 nicod-pc