Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Regex not matching a combination of IP + port #45

Open
BapRx opened this issue Aug 30, 2022 · 0 comments
Open

Regex not matching a combination of IP + port #45

BapRx opened this issue Aug 30, 2022 · 0 comments

Comments

@BapRx
Copy link

BapRx commented Aug 30, 2022

Hello, I noticed that neither the URL or the IP address regex match a combination of IP + port if no http/s scheme is provided.
I'd like to be able to click on simple IP:PORT links like 127.0.0.1:8080.

This is the result with the current URL regex:
image

Here's the IP address regex:
image

And here's what we could do to make it work:

  1. Edit the IP address regex to something like \b((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)(:\d{1,4})?:
    image

  2. Edit the URL regex to match addresses without scheme:
    ((https?:\/\/)|(www.))?(?:([a-zA-Z]+)|(\d+\.\d+.\d+.\d+))(:\d{4})? (inspired by https://stackoverflow.com/a/53519729/11819893)
    image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant