Was this helpful?
The dash ( - ) has two meanings.
1. It is the subtraction operator as in "variable - number" where both the variable and the number are numeric. The subtraction operator is used to subtract numeric variables or constants in an expression. The value of the variable on the right is subtracted from the value of the variable on the left.
counter = counter - 1; # Count down
2. The dash ( - ) is also a metacharacter that is used in regular expressions. It is used to create a range in a character class. It will match any of the characters from the character on the left of the dash to the character on the right of the dash, inclusive.
will match any string with upper case letters
will match any line that consists of only digits. For information on how they participated in this regular expression, see ^ [ ] + and $.
For a definition of a character class, see [ and ] .
Last modified date: 08/10/2022