[Issue 7674] New: regex replace requires escaped format
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 8 14:10:40 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7674
Summary: regex replace requires escaped format
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: Jesse.K.Phillips+D at gmail.com
CC: dmitry.olsh at gmail.com
--- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D at gmail.com> 2012-03-08 14:10:44 PST ---
When using std.regex.replace the format parameter is also requiring to be a
valid regex. 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.
--
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