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: nob...@puremagic.com
        ReportedBy: repeate...@gmail.com


--- Comment #0 from Masahiro Nakagawa <repeate...@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: -------

Reply via email to