Thread overview
[Issue 6212] New: regex fails to make matches that include newline
Jun 26, 2011
Nick Sabalausky
Jun 26, 2011
kennytm@gmail.com
Jun 26, 2011
Dmitry Olshansky
June 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6212

           Summary: regex fails to make matches that include newline
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: cbkbbejeap@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-06-25 17:43:39 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6212


kennytm@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kennytm@gmail.com
         Resolution|                            |INVALID


--- Comment #1 from kennytm@gmail.com 2011-06-25 23:25:10 PDT ---
The '.' does not match the new line '\n'. This is by design.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6212


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2011-06-26 03:26:05 PDT ---
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?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------