Pinned Loading
-
Describing the structure of a regex ...
Describing the structure of a regex designed to match a URL 1# Matching URLs With Regex
23## Summary
4It can be important to match a string as a URL in form or database validation. For example, a job finding platform that asks the user to enter their portfolio website could validate the user's input to make sure their input isn't gibberish. The following regex will tell the user if a string is a valid URL that will be recognized by most popular browsers:
5/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:\d{1,5})?([\/\w \.-]*)*\/?$/
-
-
-
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.