Reputation: 2683
I want to make function, that works like Windows' rename function .
When you type text and regex is a-zA-Z0-9
then you can type only "alphanumeric" characters. But characters like -, _ or + would be accepted too. Also non-english characters like č š ý ž í á
should be accepted too.
Upvotes: 0
Views: 37
Reputation: 11577
If you just want to not allow those characters in the bubble then:
function filenameOk(name){
return !/[\\/:*?<>|]/.test(name);
}
// filenameOk('čšýžíá') --> true
Upvotes: 2