Skip to main content

Character Classes

Character classes allow you to define a set of characters where any single character from that set will match.

ExpressionDescription
[cs]Matches either "c" or "s" (e.g., /licen[cs]e/ matches "licence" or "license")
[0-9]Matches any digit from 0 to 9
[a-z]Matches any lowercase letter
[A-Z]Matches any uppercase letter
[0-9a-zA-Z]Matches any alphanumeric character
[^0-9]Matches any character that is NOT a digit
[^a-z]Matches any character that is NOT a lowercase letter