1

I have this regex in my model:

/^(?:[^\W_]|\s|[\._@-])*$/u

I want add to this regex this special char:

ñáéíóú

I would like to know how add other charset from other languajes, chino, japanesse, indian...etc. Thank you.

hyperrjas
  • 10,486
  • 24
  • 98
  • 193

1 Answers1

5

I don't know if Ruby understand that, but you should use unicode properties like:

/^[\p{L}\s\p{N}._@?¿!¡€-]+$/

where

\p{L}   : any unicode letter
\p{N}   : any unicode number
Toto
  • 86,179
  • 61
  • 85
  • 118