mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 15:39:42 +08:00
Remove URL validation (#1335)
* Update ValidateUrl.js Used JS URL API to check if URL is valid. If valid it will return the url else false; * Update ValidateUrl.js Fixed for #1183 * Update ValidateUrl.js fixed code style test. Fixed for #1183 * Delete ValidateUrl.js Fixes: #1183
This commit is contained in:
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* @function ValidateURL
|
|
||||||
* @description validate the URL.
|
|
||||||
* @param {String} url - The input URL string
|
|
||||||
* @return {Boolean}
|
|
||||||
*/
|
|
||||||
const validateURL = (url) => {
|
|
||||||
const URL_PATTERN = /^(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})$/gi
|
|
||||||
|
|
||||||
return URL_PATTERN.test(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
export { validateURL }
|
|
Reference in New Issue
Block a user