Answers for "regex pattern for valid identifiers"

0

regex pattern for valid identifiers

// It can include lower and upper letters, digits and the underscore character _;
// It can only start with a letter or an underscore;
// If an identifier starts with an underscore, the second character should be either a letter or a digit, but not an underscore;
// Single _ is not a valid identifier.
String validIdentifierRegex = "^(?:_[A-Za-z0-9]|[A-Z-a-z])\\w*$";
Posted by: Guest on April-14-2022

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language