I'm looking for alphanumeric regex expression that allow only alphabets. I have tried with this this code
^[a-zA-Z0-9] $
But, it seem not work correctly. I'm looking for regex that allow only string below.
const str1 = 78;
const str2 = 'contains spaces';
const str3 = 'with symbols !@#$%^&';
const str4 = 'user78';
const str4 = 'khemvesna';
function alphanumeric(str) {
const regx = /^[a-zA-Z0-9] $/;
return regx.test(str);
}
console.log(alphanumeric(str1)); //