Feature: Character Classes
Home | Features | Improve this section
A Character Class is an Atom that specifies a set of characters to match a single character in the set.
Syntax
NOTE: The following syntax is an example based on some of the supported engines. For specific engine support, see Engines.
[…]
— Where…
is one or more single characters or character class escapes, excluding^
at the start and-
between two entries in the set. Matches a character in the set. Example:[abc]
matchesa
,b
, orc
.[^…]
— Where…
is one or more single characters or character class escapes, excluding-
between two entries in the set. Matches any character not in the set. Example:[^abc]
matchesd
,e
, orf
, etc., but nota
,b
, orc
.[a-z]
— Where a and z are single characters or character escapes. Matches any character in the range between a and z (inclusive). Example:[a-c]
matchesa
,b
, orc
, but notd
.
Engines
Engine | Supported |
---|---|
Perl | ✔ |
PCRE | ✔ |
Boost.Regex | ✔ |
.NET | ✔ |
Oniguruma | ✔ |
Hyperscan | ✔ |
ICU | ✔ |
Glib/GRegex | ✔ |
ECMAScript | ✔ |
See Also
- Posix Character Classes
- Negated Posix Character Classes
- Collating Elements
- Equivalence Classes
- Character Class Escapes
- Line Endings Escape
- Character Property Escapes
- Character Class Nested Set
- Character Class Intersection
- Character Class Union
- Character Class Subtraction
- Character Class Symmetric Difference
- Character Class Complement