The simple understanding is:
A regular expression is a set of rules and methods for handling strings, handling strings in a behavioral unit, and by means of special symbolic assistance, we can quickly filter and replace certain characters.
For example: grep (Egrep), the Sed,awk command requires regular expression mates. Improve efficiency.
Operation and maintenance work, there will be a large number of access logs, error logs, big data. All require regular expressions. (Quickly filter what you need)
The regular expression has some characters that give it a specific meaning:
Basic Regular expression: BRE
1) ^can indicates that the line starts with can.
2) can$ indicates that the line ends with can. "^$" means empty lines, for example: Grep-v "^$" to remove empty lines.
3). Represents any one of the characters (only one).
4) \ Escape symbol, let the character with special identity, invalid. For example
5) * Repeat 0 or more of the preceding characters
". *" matches all characters
6) [] symbol for repeating special characters for character sets
7) [^] means non-[^can] means non-C or a or n content [^0-9] matches non-numeric
9) {N,m} repeats n to M before a repeating character a{n,m} General curly braces need to be escaped a\{n,m\} use Egrep to remove slash
{n,} repeats a minimum of n times the previous repeating character
{n} repeats n times the previous repeating character
Extended Regular expression: ERE
1) + indicates repetition of one or more preceding characters
2)? 0 or one character (pending detection)
3) | To find multiple conforming strings in a way or chkconfig--list | Grep-e "Network|sshd"
4) () find the "user group" string
The above is an example of grep. Most available Awk,sed,grep,egrep
Find regular expression in Linux man grep search regular
Linux Regular Expressions