I need to validate text input field for special characters. But it must accept letters from all languages available.
What I have found across the web only checks for a-A0-9 alpha-numerical checks but letters like äöü are in this case considerate as special characters.
I can solve my problem with this regex check:
function onlyNumbersAndLettersAllowed(inputValue) {
var regex = /[!~`@#$%^&*()_+=-?/><,.":;{}]/;
if (inputValue.match(regex)) {
return false;
} else {
return true;
}
}
But there has to be some sophisticated solution for this. As I strive to become better developer, please show me how can I improve my code. Thanks.