Would somebody please explain?

Noam Mendelson c60b-1eq at e260-1a.berkeley.edu
Sun Apr 21 18:59:16 AEST 1991


In article <1991Apr21.001702.5661 at umbc3.umbc.edu> rouben at math16.math.umbc.edu (Rouben Rostamian) writes:
>The command:
>    expr "Match" : "Ma"
>returns 2, as it should, since the first two characters of "Match" and "Ma"
>coincide.  Now, would somebody please explain why the command:
>    expr "match" : "ma"
>complains of a "syntax error"?

Remember that 'expr string : regexp' is a pseudonym for
'expr match string regexp'.  When you use "match" as the first argument,
expr expects two additional arguments (i.e., expr is interpreting the
"match" as a command).

-- 
+==========================================================================+
| Noam Mendelson   ..!ucbvax!web!c60b-1eq       | "I haven't lost my mind, |
| c60b-1eq at web.Berkeley.EDU                     |  it's backed up on tape  |
| University of California at Berkeley          |  somewhere."             |



More information about the Comp.unix.questions mailing list