Edit 2:
const tamilRegex = XRegExp("\\p{Tamil}", "ug")
const match = XRegExp.exec(word, tamilRegex);
return match
Now, I found XRegExp a library which can handle unicode characters. The above code is the one I tried using that library still it returns wrong value.
Any help?!
Edit 1:
const word = "யாத்திராகமம்"
const firstLetter = word.match(/[^\w]/u)
console.log(firstLetter)
The above code returns ய
which is not the correct first tamil letter in that word, instead it should be யா
.
Any way to get the proper first letter in a word using regex or any other library?