hi
i have textbox and i need to check if he contain only character
how to do it with Regex in C# ?
thank's in advance
hi
i have textbox and i need to check if he contain only character
how to do it with Regex in C# ?
thank's in advance
The normal way to do that would be ^.$
.
This means only one character between the start and end anchors.
Feel free to change .
to any other limitation to suit your purposes.
And keep in mind, there may be other ways to do what you want. For example, if it's a WPF TextBox
, you can set properties on the text box itself that will restrict lengths without you having to worry about regexes.