auto s = "One 2 three 42"; auto r = `(\d+)`; assert(s.extractCapture (r).equal(["2", "42"])); assert(s.extractCapture!int(r).equal([ 2 , 42 ]));
See Implementation