Operators
Parentheses can be used for grouping to specify evaluation order or for calling commands and using the results in an expression.
- Multiply (
*
) and Divide (/
) and Power (**
) - Add () and Subtract (
-
)
The =~
and !~
operators provide a convenient way to evaluate regular expressions (opens new window). You don’t need to know regular expressions to use them - they’re also an easy way to check whether 1 string contains another.
string =~ pattern
returns true ifstring
contains a match forpattern
, and false otherwise.
Both operators use .
- In the regular expression operators, specify the case-insensitive mode modifier:
- Use the str contains command’s
--insensitive
flag:
- Convert strings to lowercase with before comparing: