I am trying to create a regular exp to stop the user entering a special character anywhere in the int string, but instead of the number and underscore inside the string except the starting point.
scripts
abhi_3123123 valid
abhi___ASDFAS valid
3425_asdfasdf invalid
_asdfasdf invalid
sometext(having any spcl character at any place) invalid
only underlining should be allowed only between them not at the beginning and at the end
updated code
im calling this code in a text event of my text field
string regEx = @"^[a-zA-Z][a-zA-Z0-9_]*(?<!_)$";
if (System.Text.RegularExpressions.Regex.IsMatch(txtFunctionName.Text, regEx))
{
//no error
}
else
{
// show error
}
this code shows an error
source
share