I am trying to do something I thought would be pretty easy to do, which is to restrict a string to certain characters by matching a regular expression.
var v
Your code looks like it's inside a function { ... }. Are you returning anything? If not, that's why you're getting null back...
function { ... }
return
null
Also, regexes are surrounded by slashes (/.../), not quotes.
/.../