[Issue 7674] regex replace requires escaped format
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 9 03:30:41 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7674
--- Comment #1 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2012-03-09 03:30:45 PST ---
(In reply to comment #0)
> When using std.regex.replace the format parameter is also requiring to be a
> valid regex.
Strange.
But speaking of format string it is expected to be a plain string there is no
need to escape a thing in there IRC.
The below example is expected to pass
>
> import std.regex;
>
> void main() {
> auto str = "hello?";
>
> assert(str.replace(regex(r"\?", "g"), r"\?") == r"hello\?");
> }
>
> This should fail:
>
> import std.regex;
>
> void main() {
> auto str = "hello?";
>
> assert(str.replace(regex(r"\?", "g"), r"\\?") != r"hello\?");
> }
>
> Maybe I'm wrong on this, but the current requirement seems off.
Apparently it is, I'll take a look.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list