digitalmars.D.bugs - [Issue 5712] New: [patch] std.regex.replace disallows w/dstring
- d-bugmail puremagic.com (26/26) Mar 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5712
- d-bugmail puremagic.com (73/73) Mar 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5712
- d-bugmail puremagic.com (10/10) Dec 09 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5712
http://d.puremagic.com/issues/show_bug.cgi?id=5712 Summary: [patch] std.regex.replace disallows w/dstring Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: patch, rejects-valid Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: rayerd.wiz gmail.com PST --- Created an attachment (id=930) std.regex.replace came to accept w/dstring This issue was reported at 2ch.net. import std.regex; void main() { .replace("a", .regex("a"), "b"); // ok .replace("a"w, .regex("a"w), "b"w); // compile error .replace("a"d, .regex("a"d), "b"d); // compile error } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5712 PST --- (From update of attachment 930) From 22abb3531c34705395bee0c87b4c50ad9104adbe Mon Sep 17 00:00:00 2001 From: haru-s <rayerd.wiz gmail.com> Date: Mon, 7 Mar 2011 03:56:41 +0900 Subject: [PATCH] std.regex.replace came to accept w/dstring. --- std/regex.d | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/std/regex.d b/std/regex.d index 683148f..9c00a0a 100644 --- a/std/regex.d +++ b/std/regex.d -2576,8 +2576,8 and, using the format string, generate and return a new string. private static Range replace3(String)(String format, Range input, regmatch_t[] pmatch) { - string result; - uint c2; + Range result; + Unqual!(ElementType!String) c2; sizediff_t startIdx; sizediff_t endIdx; int i; -2586,7 +2586,7 and, using the format string, generate and return a new string. result.length = 0; for (size_t f = 0; f < format.length; f++) { - char c = format[f]; + Unqual!(ElementType!String) c = format[f]; L1: if (c != '$') { -2640,7 +2640,7 and, using the format string, generate and return a new string. { result ~= '$'; result ~= c; - c = cast(char)c2; + c = c2; goto L1; } } -2665,7 +2665,7 and, using the format string, generate and return a new string. } return result; } - + /* *********************************** * Like replace(char[] format), but uses old style formatting: <table border=1 cellspacing=0 cellpadding=5> -2755,6 +2755,13 unittest assert(match("abc", regex(".b..")).empty); } +unittest +{ + replace("a", regex("a"), "b"); + replace("a"w, regex("a"w), "b"w); + replace("a"d, regex("a"d), "b"d); +} + //------------------------------------------------------------------------------ /** -- 1.7.3.1.msysgit.0 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 06 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5712 Dmitry Olshansky <dmitry.olsh gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |dmitry.olsh gmail.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 09 2011