www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6212] New: regex fails to make matches that include newline

reply d-bugmail puremagic.com writes:
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



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: -------
Jun 25 2011
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jun 25 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jun 26 2011