Need some help from you javascript regexp pro's
I have a function that I want to pass in some a "value" and a list of accepted characters. This function works in php, but the javascript variables don't work the same as in php, so I need some guiadance.
I would like to call this function like this:
isAlphaNumeric(myValue, "_-");
This would allow any number, or letter as well as the underscore and the hyphen, but no other characters
This is the function I have, but doesn't quite work right.
function isAlphaNumeric(value, allow)
{
var result = /^[A-Za-z0-9+allow+]+$/.test(value);
return result;
}
How can I accomplish what I'm after?
Thanks for the help.