
Linux Shell Scripting Essentials
By :

Regular expression (also known as regex or regexp) provides a way of specifying a pattern to be matched in a given big chunk of text data. It supports a set of characters to specify the pattern. It is widely used for a text search and string manipulation. A lot of shell commands provide an option to specify regex such as grep
, sed
, find
, and so on.
The regular expression concept is also used in other programming languages such as C++, Python, Java, Perl, and so on. Libraries are available in different languages to support regular expression's features.
The metacharacters used in regular expressions are explained in the following table:
Metacharacters |
Description |
---|---|
* (Asterisk) |
This matches zero or more occurrences of the previous character |
+ (Plus) |
This matches one or more occurrences of the previous character |
? |
This matches zero or one occurrence of the previous element |
. (Dot) |
This matches any one character |
^ |
This matches... |
Change the font size
Change margin width
Change background colour