Regular expressions are a declarative language, mainly used for pattern matching within strings. Please include a tag specifying the programming language you are using, together with this tag.
Regular and Irregular Expressions
Regular expressions are a powerful form of declarative programming language, mainly used for pattern matching within strings. Students of computer science know them as the user-friendly face to the abstruse ﬁeld of finite automata. The rest of us think of them as string matching using wildcards.
Depending on which flavor you’re using, modern regular expressions can allow backreferences, conditional subpatterns, regex subroutines, code callouts, positive and negative lookahead/lookbehind assertions, and even recursion. This rich feature set allows them to parse far more than the strictly regular languages for which they were originally named. Today we still call these pattern-matching languages regular expressions (or regexes for short), even though the reg- part is little more than an historical artifact which no longer applies.