www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3880] New: std.regex functions with const/immutable Regex object

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3880

           Summary: std.regex functions with const/immutable Regex object
           Product: D
           Version: 2.040
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: repeatedly gmail.com


--- Comment #0 from Masahiro Nakagawa <repeatedly gmail.com> 2010-03-05
01:31:57 PST ---
A few days ago, I wrote Alcor's scoring algorithm (source is here
http://d.hatena.ne.jp/repeatedly/20100302/1267541283 (text in japanese)). At
that time, I notice std.regex functions can't use const/immutable Regex object.

const r = regex("123");
//auto m = "0123".match(r);          // Error: template
std.regex.match(Range,Engine) if ...
//auto c = "0123".replace(r, "456"); // Error: no overload matches for
replace(T,Range)

I think match and replace shuold use const/immutable Regex object (splitter can
use const/immutable object).

Finally, std.regex.splitter example of DDoc is incorrect.

auto s1 = ", abc, de,  fg, hi, ";
assert(equal(splitter(s1, regex(", *")),
    ["", "abc", "de", "fg", "hi"][]));   // lack last element

auto s1 = ", abc, de,  fg, hi, ";
assert(equal(splitter(s1, regex(", *")),
    ["", "abc", "de", "fg", "hi", ""][]));  // correct!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 05 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3880


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rsinfu gmail.com
         Resolution|                            |FIXED


--- Comment #1 from Shin Fujishiro <rsinfu gmail.com> 2010-05-23 04:59:19 PDT
---
Fixed in svn r1545.

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