Regular expression

A regular expression (or regex) is a match pattern. They allow searching large amounts of text or making sure strings meet specific criteria. This is useful for checking if passwords contain lowercase, uppercase, and a few special characters. It can also be used to validate if a string is a valid email address.

Regular expressions are one of the few exceptions for commenting code. This is because it can be difficult to understand a regular expression.

A regular expression can have special characters that have a special meaning. The backslash \ is used to escape a special character.