https://d.puremagic.com/issues/show_bug.cgi?id=12227
Summary: Allow matching multiple patterns in one go with std.regex Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: dmitry.o...@gmail.com --- Comment #0 from Dmitry Olshansky <dmitry.o...@gmail.com> 2014-02-22 13:38:38 PST --- Synposis: auto m = matchFirst("42 days", `[a-z]+`, `\d+`); assert(m.index == 2); //2nd pattern match assert(m.index != 0); //same as not empty foreach(item; "42 days".matchAll(`[a-z]+`, `\d+`)) { switch(item.index){ case 1: assert(item[0] == "days"); break; case 2: assert(item[1] == "42"); break; default: assert(0); } } Rationale - as a more efficient common basis for pattern matching (e.g. switch-case on with regex patterns as cases). -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------