Right, but when you’re indexing, the regex match has to be unwrapped which will cause task failure if the match fails. I suppose an alternative to this is to return a zero length slice if the regex doesn’t match. (This will conflate zero-length matches with non-matches, but that’s probably OK to gloss over for a convenience such as indexing.)
I agree it’s a neat trick, I’m just trying to say that this can be done entirely outside of the regex crate with almost no downsides. (Wrapper types are usually inconvenient because you have to re-implement all of the behavior of the underlying type, but in this case, all you really need it for is construction.)
Also, more importantly, I’m pretty sure that your if let Some(match) = a_string[regex!(r"...")] {} construct is not possible. (Whoops, @kstep beat me to it.)