Feature: Character Class Escapes
Home | Features | Improve this section
A Character Class Escape is a single character escape that represents an entire character class. They can be used as an element of a Character Class or as an Atom. It is often the case that a lower-case escape character is the inclusive set, while an upper-case variant of the same character excludes that set.
Syntax
NOTE: The following syntax is an example based on some of the supported engines. For specific engine support, see Engines.
\d
— A decimal digit character in the range 0-9. Equivalent to[0-9]
.\D
— Any character not in the range 0-9. Equivalent to[^0-9]
.\w
— Any “word” character. Equivalent to[a-zA-Z0-9_]
.\W
— Any non-“word” character. Equivalent to[^a-zA-Z0-9_]
.\s
— Any whitespace character.\S
— Any non-whitespace character.
Engines
Engine | Supported |
---|---|
Perl | ✔ |
PCRE | ✔ |
Boost.Regex | ✔ |
.NET | ✔ |
Oniguruma | ✔ |
Hyperscan | ✔ |
ICU | ✔ |
Glib/GRegex | ✔ |
ECMAScript | ✔ |
See Also
- Character Classes
- Posix Character Classes
- Negated Posix Character Classes
- Collating Elements
- Equivalence Classes
- 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