I am validating username using regex in JS. However, it was giving me an error for the other country character. So I found regex for the other country character.
if(/^[a-zA-Z0-9äöüÄÖÜß\u4E00-\u9FAF\u3040-\u3096\u30A1-\u30FA\uFF66-\uFF9D\u31F0-\u31FF\x30A0-\x30FFñáéíóúü\p{Han}\u1100-\u11FF|\u3130-\u318F|\uA960-\uA97F|\uAC00-\uD7AF|\uD7B0-\uD7FFàâäèéêëîïôœùûüÿçÀÂÄÈÉÊËÎÏÔŒÙÛÜŸÇ\u00C0-\u017F\u4E00-\u9FFF|\u2FF0-\u2FFF|\u31C0-\u31EF|\u3200-\u9FBF|\uF900-\uFAFFzàèéìòóù\u00E0\u00E8\u00E9\u00EC\u00F2\u00F3\u00F9._-]{1,160}$/i.test(text)){
console.log('correct word');
} else {
console.log('wrong word');
}
But i only want to allow some specific country e.g
Korean: Hangul, Chosŏn'gŭl
Japanese: Hiragana, katakana (full width), kanji
German
Spanish
French
Italian
Chinese: Simplified Chinese
Russian
Portuguese.
I want i can manually remove any country character, e.g i want to remove "Simplified Chinese", but i don't what i can do in my code because i don't know which string is used for which country character in if condition. Could anyone please help?