A single regular expression to match.
The _attributes (g, i, m, s and x accepted)
Regex object that works on inputs having the same character width as pattern.
RegexException if there were any errors during compilation.
1 void test(S)() 2 { 3 // multi-pattern regex example 4 S[] arr = [`([a-z]+):(\d+)`, `(\d+),\d+`]; 5 auto multi = regex(arr); // multi regex 6 S str = "abc:43 12,34"; 7 auto m = str.matchAll(multi); 8 assert(m.front.whichPattern == 1); 9 assert(m.front[1] == "abc"); 10 assert(m.front[2] == "43"); 11 m.popFront(); 12 assert(m.front.whichPattern == 2); 13 assert(m.front[1] == "12"); 14 } 15 16 import std.meta : AliasSeq; 17 static foreach (C; AliasSeq!(string, wstring, dstring)) 18 // Test with const array of patterns - see https://issues.dlang.org/show_bug.cgi?id=20301 19 static foreach (S; AliasSeq!(C, const C, immutable C)) 20 test!S();
Compile regular expression pattern for the later execution.