Regular expression or Regex (also regexp) is a notation system for describing a search pattern defined by a sequence of characters. It is primarily used for search and replace, data validation and string parsing. Regex is based on formal language theory and consists of constants (called “literal characters”) which define sets of strings and operator symbols (called “meta-characters”) which define operations to be performed on these sets.