View Issue Details

IDProjectCategoryView StatusLast Update
00005951003.1(2008)/Issue 7Base Definitions and Headerspublic2019-06-10 08:55
Reportereblake Assigned Toajosey  
PrioritynormalSeverityEditorialTypeError
Status ClosedResolutionAccepted 
NameEric Blake
OrganizationRed Hat
User Referenceebb.BRE
SectionXBD 9.3
Page Number186
Line Number6017
Interp Status---
Final Accepted Text
Summary0000595: regular expressions do not operate on lines
DescriptionThe standard is clear (XBD 3.205, line 1920) that a line is a sequence of characters terminated by an included <newline>. Furthermore, the standard is clear that in situations where <newline> may appear in a regular expression pattern or in the text the pattern is to be matched against (namely, any RE used in XSH, and in explicitly documented cases within XCU), then the <newline> character is treated as normal (XBD 9.2, line 5839, see also 0000554). That is, RE matching is not done on lines, and utilities that process lines must first strip the <newline> before applying the RE. Likewise, the regular expression "^b" matched against the C string "a\nb" does not match (that is, "^" does not anchor to just after a newline character at the start of any line in the target string, but only to the beginning of the overall target string).

However, there are spots in the RE definitions that still refer to 'line' when a more appropriate term should be used.

[Implementations are still free to provide extensions where ^ matches per-line rather than per-string; for example, glibc provides an alternative regular expression interface with flag bits that determine which level of granularity the anchors behave, and whether <newline> is treated as a regular character, but that is outside the scope of this standard.]
Desired ActionAt line 6017 (9.3.6 BREs Matching Multiple Characters, rule 3), change:

For example, the expression "ˆ\(.*\)\1$" matches lines consisting of two adjacent appearances of the same string,

to

For example, the expression "ˆ\(.*\)\1$" matches strings consisting of two adjacent appearances of the same substring,

At line 6053 (9.3.8 BRE Expression Anchoring), change:

A BRE can be limited to matching strings that begin or end a line; this is called ‘‘anchoring’’.

to

A BRE can be limited to matching expressions that begin or end a string; this is called ‘‘anchoring’’.

At line 6175 (XBD 9.4.9 ERE Expression Anchoring), change:

An ERE can be limited to matching strings that begin or end a line; this is called ‘‘anchoring’’.

An ERE can be limited to matching expressions that begin or end a string; this is called ‘‘anchoring’’.

Tagstc2-2008

Relationships

related to 0000554 Closedajosey 1003.1(2008)/Issue 7 Five(?) clarifications of the informal regex descriptions 
has duplicate 0000976 Closed 1003.1(2013)/Issue7+TC1 improper use of "line" to describe the ^ and $ operators 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2012-07-19 23:48 eblake New Issue
2012-07-19 23:48 eblake Status New => Under Review
2012-07-19 23:48 eblake Assigned To => ajosey
2012-07-19 23:48 eblake Name => Eric Blake
2012-07-19 23:48 eblake Organization => Red Hat
2012-07-19 23:48 eblake User Reference => ebb.BRE
2012-07-19 23:48 eblake Section => XBD 9.3
2012-07-19 23:48 eblake Page Number => 186
2012-07-19 23:48 eblake Line Number => 6017
2012-07-19 23:48 eblake Interp Status => ---
2012-07-20 15:20 eblake Relationship added related to 0000554
2012-07-26 15:59 Don Cragun Status Under Review => Resolved
2012-07-26 15:59 Don Cragun Resolution Open => Accepted
2012-07-26 15:59 Don Cragun Tag Attached: tc2-2008
2015-09-23 08:21 geoffclare Relationship added has duplicate 0000976
2019-06-10 08:55 agadmin Status Resolved => Closed