javascriptregexcharacternon-englishturkish

take non-English alphabet characters beside English, as well - React-Native


I'm quite new to React-Native. I'm validating the input from the user for name field with 'match(/^[a-zA-Z ]+$/)' so to prevent input like special character or number. But I need to be able to get Turkish(ş,ü,ö,ı) characters as well, beside English letters. How can I do it?

I hope there is someone that can help me.


Solution

  • Just add them in the character class:

    /^[a-zA-Z şüöı]+$/