I've got a string of text that becomes part of the filename that gets saved out. I need to remove any illegal characters (ie non alpha numeric, only latin based characters)
This is what I have so far:
Figured it out, regex-fu levels back to normal!
function isValidFilename(fname)
{
var rexp = new RegExp(/[^a-zA-Z0-9]/gim)
return fname.replace(rexp, "")
}
var v = "my$filename"
alert(v + "\nis valid???\n\n" + isValidFilename(v))
v = "myfilename"
alert(v + "\nis valid???\n\n" + isValidFilename(v))