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?

_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to