To define a regex pattern, you can type the following:
$ echo "Welcome to shell scripting" | sed -n '/shell/p'
$ echo "Welcome to shell scripting" | awk '/shell/{print $0}'
![](https://static.packt-cdn.com/products/9781788990554/graphics/assets/0b72a10f-089f-49d4-abd9-31b3e728cf5b.png)
A very important thing you need to know about regex patterns in general is they are case sensitive:
$ echo "Welcome to shell scripting" | awk '/shell/{print $0}'
$ echo "Welcome to SHELL scripting" | awk '/shell/{print $0}'
![](https://static.packt-cdn.com/products/9781788990554/graphics/assets/3672126e-36f9-4e1c-8260-a225ade9dd96.png)
Say you want to match any of the following characters:
.*[]^${}\+?|()
You must escape them with a backslash because these characters are special characters for the regex engines.
Now you know how to define a BRE pattern. Let's use the common BRE characters.