A set of useful regular expressions
let regUrl = /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/;
let regEmail = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
let regAlphaNumeric = /^[a-z0-9_-]{6,18}$/;
let reqNumeric = /^\d+$/;
let regAlpha = /^[a-zA-Z ]*$/;
// to test a value
if(regUrl.test('foo')) {
return true;
} else {
return false;
}