Search code examples
c#asp.netregexvalidationtextbox

Textbox validation with hebrew input


I'm making a contact page so user's can send message to me when they want. I got a textbox that they can put thire name, and regular expression to check if the name is in the correct form.

[אבגדהוזחטיכלמנסעפצקרשתץףןם\s\.]

My problem is that when I enter hebrew characters into the textbox its still don't recognize it and I get a validation error.

I tried the same regualr expression with an English unicode [a-zA-Z] and it work.

Do I need to add somthing to the .aspx page so it will "understand" that the input is in different language?


Solution

  • Perhaps the problem is that you only allow one character with your regular expression?

    Try to change it to

    [אבגדהוזחטיכלמנסעפצקרשתץףןם\s\.]*
    

    Apart from that, I don´t think that you need to add any culture info to the page.