[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
POSIXly incorrect REs in expr(1) ?
From: |
Phil Homewood |
Subject: |
POSIXly incorrect REs in expr(1) ? |
Date: |
Tue, 10 Apr 2001 10:13:02 +1000 |
User-agent: |
Mutt/1.2.5i |
Hi,
I believe expr is not POSIX compliant in its regular expression
handling.
POSIX 1003.2 states:
| 4.22.7.1 Matching Expression
|
| The ':' matching operator shall compare the string resulting from the
| evaluation of expr1 with the regular expression pattern resulting from
| the evaluation of expr2. Regular expression syntax shall be that defined
| in 2.8.3 (Basic Regular Expressions), except that all patterns are
| ``anchored'' to the beginning of the string (that is, only sequences
| starting at the first character of a string shall be matched by the
| regular expression) and, therefore, it is unspecified whether ^ is a
| special character in that context.
[...]
| In an earlier draft, Extended Regular Expressions were used in the
| matching expression syntax. This was changed to the Basic variety to
| avoid breaking historical applications.
where section 2.8.3 defines the only special characters within a BRE
as
. [ \ * ^ $
However, ``info expr'' states:
In the regular expression, `\+', `\?', and `\|' are operators
which respectively match one or more, zero or one, or separate
alternatives. SunOS and other `expr''s treat these as regular
characters. (POSIX allows either behavior.)
I believe this last statement to be incorrect, and expr's behaviour
to violate the POSIX spec. Comments?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- POSIXly incorrect REs in expr(1) ?,
Phil Homewood <=