auto whole = `xyz`; import std.algorithm.searching : skipOver; assert(whole.tryEvery(whole.skipOver('x'), whole.skipOver('z')) == []); // failing match assert(whole == `xyz`); // should restore whole assert(whole.tryEvery(whole.skipOver('x'), whole.skipOver('y'), whole.skipOver('w')) == []); // failing match assert(whole == `xyz`); // should restore whole assert(whole.tryEvery(whole.skipOver('x'), whole.skipOver('y')) == [true, true]); // successful match assert(whole == `z`); // should digest matching part
Evaluate all parts possibly digesting whole.
If all values of parts implicitly convert to bool true, return the values as an array, otherwise restore whole and return null.