[Issue 3880] New: std.regex functions with const/immutable Regex object
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 5 01:32:02 PST 2010
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: nobody at puremagic.com
ReportedBy: repeatedly at gmail.com
--- Comment #0 from Masahiro Nakagawa <repeatedly at 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: -------
More information about the Digitalmars-d-bugs
mailing list