Subject: Re: expr "foo" : '/'
To: Andrew Cagney <firstname.lastname@example.org>
From: Nathan J. Williams <email@example.com>
Date: 02/06/2002 12:27:51
Andrew Cagney <firstname.lastname@example.org> 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 : '.*/\(.*\)'