domain name validation logic
This commit is contained in:
13
helpers/utils.js
Normal file
13
helpers/utils.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Utility functions for the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const isValidDomain = (domain) => {
|
||||||
|
// Regular expression to validate a domain name
|
||||||
|
const domainRegex = /^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
|
||||||
|
return domainRegex.test(domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
isValidDomain
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user