What is a regular expression?
A regular expression (regex) is a compact pattern that describes text. You use it to find, validate, and transform strings — checking that input looks like an email address, pulling numbers out of a log line, or renaming fields in bulk.
A pattern is built from literal characters plus metacharacters such as ., *, and \d, and is applied with a set of flags that change how matching behaves.