fixed validation
This commit is contained in:
parent
1f4488c568
commit
f47af5a139
@ -15,12 +15,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// Function to validate URLs
|
||||
const isValidURL = (url) => {
|
||||
const pattern = new RegExp(
|
||||
'^(https?:\\/\\/)' + // Protocol (http or https)
|
||||
'(([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,})' + // Domain name
|
||||
'(\\:[0-9]{1,5})?' + // Optional port number
|
||||
'(\\/.*)?$', // Path, query string, or fragment
|
||||
'^(https?:\\/\\/)?' + // Protocol (http or https)
|
||||
'(([a-zA-Z0-9_-]+\\.)+[a-zA-Z]{2,6})' + // Domain name
|
||||
'(\\/[a-zA-Z0-9@:%_\\+.~#?&//==-]*)?$', // Path, query, or fragment (now includes `=`)
|
||||
'i'
|
||||
);
|
||||
);
|
||||
|
||||
return pattern.test(url);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user