Analyzing Different Types of Regular Expressions

Character classes

A character class allows us to specify which characters are acceptable for any given position. For example, suppose we had the following pattern:

/abc/

We can interpret it as a literal a followed by a literal b followed by a literal c. Suppose we wanted to match all substrings that contained those three characters in any order. We can achieve this using a character class. We define character classes by specifying what characters are allowed between square brackets:

Get hands-on with 1200+ tech skills courses.