IEEE Standards Interpretations for IEEE Std 1003.2™-1992 IEEE Standard for Information Technology--Portable Operating System Interfaces (POSIX®)--Part 2: Shell and Utilities
Copyright © 1996 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.
Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.
IEEE Standards Department, Copyrights and Permissions, 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA
Interpretation Request #120
Topic: expr Relevant Clauses: 220.127.116.11
Subclause 18.104.22.168 of POSIX.2 specifies the syntax and semantics of the expr utility. This subclause reads: The ':' matching operator shall compare the string resulting from the evaluation of expr1 with the BRE pattern resulting from the evaluation of expr2. BRE syntax shall be that defined in 2.8.3, 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 BRE). Therefore, it is unspecified whether ^ is a special character in that context. Note that this description does not say that it is "implementation defined", but rather "unspecified" whether ^ is an anchor when used in the BRE of an expr matching expression. As such, this implies that a conforming implementation of expr need not even behave consistently from one invocation to the next when a ^ is used in a BRE on the right side of a ':' operator. Since the BRE is not a subexpression, the system defined behavior of anchors in subexpressions does not apply here. Is this the intention?
It is difficult to state what the intention was, but the standard is clear. If "implementation defined" were used instead of "unspecified", it would not affect a conforming POSIX.2 application.
Rationale for Interpretation