A regular expression is a sequence of characters that forms a search pattern. It can be used to match, search, or manipulate strings based on certain patterns.