-1

I am using reactive forms with validators. For the arabic name field I am using:

Validators.pattern('[\u0600-\u06FF ]*')

But I can't figure out the pattern for latin letters of A-Z and a-z.

I tried:

Validators.pattern(/^-?([a-z]\d*)?$/)

But it didn't work.

alim1990
  • 4,656
  • 12
  • 67
  • 130

3 Answers3

2

try to apply this pattern: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/

Ajay Ojha
  • 380
  • 1
  • 3
  • 9
  • for arabic :https://stackoverflow.com/questions/12847333/include-arabic-characters-in-javascript-regular-expression – zedtimi Dec 11 '18 at 10:45
2

i use this regex:

    Validators.pattern('^[a-zA-Z][a-zA-Z0-9-_@\.]{2,20}$')

And

   Validators.pattern(/[\u0600-\u06FF-/ ]/) for arabic
zedtimi
  • 306
  • 1
  • 6
-1

The answer was by simply using:

Validators.pattern('[a-zA-Z ]*')

To allow numbers with them:

Validators.pattern('[a-zA-Z0-9 ]*')
alim1990
  • 4,656
  • 12
  • 67
  • 130