Skip to content

Commit

Permalink
Merge pull request #1641 from blackwhale/ctr-replace
Browse files Browse the repository at this point in the history
[REG 2.064a] 11262 std.regex.replace does not accept StaticRegex
  • Loading branch information
dnadlinger committed Oct 15, 2013
2 parents cbd3983 + 8f00475 commit b7982f7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion std/regex.d
Original file line number Diff line number Diff line change
Expand Up @@ -6066,7 +6066,7 @@ private @trusted void replaceCapturesInto(alias output, Sink, R, T)
// ditto for a range of captures
private void replaceMatchesInto(alias output, Sink, R, T)
(ref Sink sink, R input, T matches)
if(isOutputRange!(Sink, dchar) && isSomeString!R && is(T == RegexMatch!R))
if(isOutputRange!(Sink, dchar) && isSomeString!R)
{
size_t offset = 0;
foreach(cap; matches)
Expand Down Expand Up @@ -7411,4 +7411,13 @@ unittest
}();
}

// bugzilla 11262
unittest
{
enum reg = ctRegex!(r",", "g");
auto str = "This,List";
str = str.replace(reg, "-");
assert(str == "This-List");
}

}//version(unittest)

0 comments on commit b7982f7

Please sign in to comment.