Building a regular expression involves defining a pattern which you want to match in a text. This is done using a combination of metacharacters, sequences and sets. For example, the regular expression /a.b/ will match any string containing 'a', any character, then 'b'. Regular expressions are used in programming for searching and manipulating text.