I want to make my alphanumeric regex dynamic in a way that it takes the allowed special characters with it as an argument by the user. Following is my code ... I am getting quotes error here .... any body can tell me how to go about it ?
function aplhanumeric(value,allowed){
///^[a-z0-9_\-]+$/i
alert(allowed);
if(allowed != ''){
var regex = new RegExp('/^[a-z0-9_\' + allowed + ']+$/i');
return (value.match(regex));
}else{
return (alphaNumericRegex.test(value));
}
}