Basis
/.../A regex is enclosed between two forward slashes.
\Cancels the special effect of a special character.
|Alternative (or).
^Start of line.
$End of line.
[ ab ]Match one of the characters inside the square brackets (a or b).
[ a-z ]Match on a range of characters.
[^a]Match if the character is not the one that is after the
^
.(myWord)Match the group inside the parenthesis.
.Match any character.
?The preceding element is present 0 or 1 times.
{ 2 }The preceding element is repeated a defined a number of times.
{ 0,3 }The preceding element is repeated between 0 and 3 times.
*The preceding element is repeated between 0 and infinite number of times.
+The preceding element is repeated between 1 and infinite number of times.
Useful Regex
ip addr show eth0 | grep -oP '(?<=inet\s)\d+(.\d+){3}'Get IP Linux
eth0
interface.