Bug 6212 – regex fails to make matches that include newline

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-06-25T17:43:00Z
Last change time
2011-06-26T03:26:05Z
Assigned to
nobody
Creator
bus_dbugzilla

Comments

Comment #0 by bus_dbugzilla — 2011-06-25T17:43:39Z
import std.stdio; import std.regex; void main() { string str = "ABC\nDEF"; str = str.replace(regex("B(.*)E"), ""); writeln(str); } Expected Output: AF Actual Output: ABC DEF Note that the "m" attribute ("treat as multiple lines separated by newlines") was NOT used.
Comment #1 by kennytm — 2011-06-25T23:25:10Z
The '.' does not match the new line '\n'. This is by design.
Comment #2 by dmitry.olsh — 2011-06-26T03:26:05Z
Technically deep down std.regex there *is* an option to do that, namely REA.dotmatcheslf option. However it was never exposed in std.regex interface... So we definitely need to do one of two: expose "dot matches lf" option or kill all of it inside implementation to remove junk. Thoughts?