It's basically recognizing patterns.
If you can tell a program to look for patterns, you can have the program change or record or reproduce or whatever you want it to do.
Typically, they're used for search and replace operations -- including replacing with nothing (thus deleting.)
Imagine you have a text file: in that file are recurring lines that have a single number (page numbers, for instance.) They don't add anything to an ebook, in fact they interrupt the reading experience:
blah blah blah I'm a great shaper of words blah
blahbety blah geflugehh cthulhu
Using regular expressions (regex) you can search for the pattern "any line that has only a number on it" and replace it with nothing. (That pattern might look like ^\d+\n
or other variations. The ^
means "at the beginning of the line"; the \d
means "digits"; the +
means "one or more" and the \n
means "carriage return". Together they identify the pattern "one or more digits occurring at the beginning of a line, followed immediately by a carriage return".
Once you get familiar with the symbols, you can identify any recurring pattern and, as you get more sophisticated, you can extract information from those patterns and restructure and replace it.
It's really worth learning, especially if you are doing proofreading and editing of texts.
m a r