I have to point out that it doesn’t use the task failure, it just returns an empty slice.
Also, after extending the syntax a bit, this feels quite useful to me:
let foo = &uri[ri! (regex! (r"^/path/(\w+)/$$"), 1)];
Arguably it’s intuitive, because taking a slice from a &str is obvious here. One doesn’t need to guess at the types, errors and how to handle them, we just get a slice, either an empty one or with the matched group.
If regex! dependency wouldn’t have been a problem, I’d even made it into
let foo = &uri[ri! (r"^/path/(\w+)/$$", 1)];
I really wish Rust’ve choosed the other way 'round the orphans, allowing one to extend the types freely as in Google Go and Scala (and Haskell?).