45.29 Testing Characters in a String with expr
command does a lot of different things with expressions.
One expression it handles has three arguments: first, a string; second,
a colon (
can count the number of characters that match the
The regular expression is automatically anchored to the
start of the string you're matching, as if you'd typed a
When a regular expression matches some character(s), expr returns a zero ("true") exit status (44.7 ) . If you want a true/false test like this, throw away the number that expr prints and test its exit status: