-2
const isFullnameValid = computed<boolean>(() => {
  const fullnameRegex: RegExp =   /^[A-Za-z ]+$/;
  return formData.value.fullname.length > 0 && 
         fullnameRegex.test(formData.value.fullname);
});

My Regex now identify if var contains any symbol or number it works fine but it only reads latin alphabet and i want to dont only read latin alphabet for example regex is true when i type GIORGI SHALAMBERIDZE but it is false when i write გიორგი შალამბერიძე.

2 Answers2

1

You can use Unicode property \p{L} to match any letter.

Your regex in this case will be /^[ \p{L}]+$/u. Notice that you need to use u flag, for regex engine to understand Unicode properties.

Demo here.

Additionally, to match any kind of spaces and punctuation marks you can use ^[\p{Z}\p{P}\p{L}]+$

And finally, to match even name of a child of one notorious CEO, you'll need property for digits: ^[\p{Z}\p{P}\p{L}\p{N}]+$

markalex
  • 8,623
  • 2
  • 7
  • 32
-1

I found answer finally for my self. to accept all language alphabet you can use /^[\p{L}\s]+$/u;