D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2107 - Regexp multiline attribute is broken
Summary: Regexp multiline attribute is broken
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Linux
: P2 normal
Assignee: Andrei Alexandrescu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-14 22:06 UTC by William Moore
Modified: 2015-06-09 01:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description William Moore 2008-05-14 22:06:22 UTC
When matching on text that includes newlines, multiline matching (splitting the string on newlines first and then matching on individual lines) seems to be the default and makes the "m" attribute useless.  It also requires the removal of all newlines if they need to be matched over.  The following code snippet should show the issue:
if (auto m = std.regexp.search("foo\nbar","f.*r")) {
        writefln("match found: %s",m.match(0));
} else {
        writefln("no match!");
}
Comment 1 Andrei Alexandrescu 2010-09-25 22:21:18 UTC
The "m" flag refers to the behavior of ^ and $, not that of the dot.