hyperrjas
hyperrjas

Reputation: 10744

add special characters regex ruby

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.

Upvotes: 1

Views: 3593

Answers (1)

Toto
Toto

Reputation: 91375

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

Upvotes: 5

Related Questions