Search⌘ K

Character Classes

Explore how to build and use character classes in Perl regular expressions. Understand grouping of alternatives, use of hyphens for ranges, and how to negate classes for advanced text matching techniques. Gain practical knowledge to enhance your regex skills in Perl.

Allowing alternatives

When none of those metacharacters is specific enough, we can group multiple characters into a character class by enclosing them in square brackets. A character class allows us to treat a group of alternatives as a single atom: ...