Subject: Re: expr "foo" : '/'
To: Andrew Cagney <email@example.com>
From: Nathan J. Williams <firstname.lastname@example.org>
Date: 02/06/2002 12:27:51
Andrew Cagney <email@example.com> writes:
> This is one for the POSIX police. Is:
> $ expr "foo" : '/'
> expr: syntax error
I think it's ambiguous; the : operator has higher precedence than the
/ operator, but it's unclear whether the '/' should be considered a
regexp for : or a lonely, invalid division operator.
Note that expr(1) has been thoroughly reimplemented (entirely in
yacc!) in -current, though, and the behaviour of that expression has
$ expr "foo" : '/'
$ expr "foo" : '\/'
$ expr //a : '.*/\(.*\)'