regexurl-validation

What is url-validation regex and what is it used for?


A person I know told me that Javascript files with URL validation codes are malicious.

My questions are:


Solution

  • URL validation checks if a given text is a URL or not. Such a check is often performed when a user has to enter a URL on a web form, to ensure that the entered text corresponds to a URL.

    Since you have regex in your tags: Why is using regex bad for this? Because many people don't read the full URL specification when writing their regex. For example, have a look at this post in which many different regex that are used out in the wild are compared, and how they fail.