Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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*$";
 
PREVIOUS NEXT
Tagged: #regex #pattern #valid #identifiers
ADD COMMENT
Topic
Name
3+8 =