I have a regex to validate valid identifiers in a script language. They begin with a letter or underscore, and can be followed by 0 or more letters, underscores, numbers, and symbols. However, if I call
Util.IsValidIdentifier( "hello\n" );
it returns true. My regex
const string IDENTIFIER_REGEX = @"^[A-Za-z_][A-Za-z0-9_\$]*$";
so how does "\ n" go?
source share