Regex101.com needs help getting a small Rust WASM binary

295 points pluots0

Chances are many of you have used regex101.com to help debug regex queries - it’s amazing. Unfortunately, Rust is notably missing from the language list (it's very similar to Golang, but not exact).

The maintainer of the website is open to adding a Rust flavor, but it seems like there has been some difficulty getting the size of the generated wasm down to ideally <500kB (rough requirement set by the author). Current sizes are closer to 3 MB: link to the discussion: https://github.com/firasdib/Regex101/issues/1208

I know there are a ton of nuanced ways to optimize wasm (different allocators, somewhat hidden compiler options and such) and I know there are a lot of people here who know how to use them correctly. If you are one of those people and have the time, try your hand at making the smallest possible Regex binary. Just join in the discussion above if you’re successful, or have ideas for what to try. The entire Rust community will thank you!

I think that all that is needed is a way to accept an input string and flags, map those flags to RegexBuilder options, and return the expanded results of captures_iter(). A simple wrapper to call replace_all() would work for the replacer section of the site.

(I am not associated with the site at all, just somebody who’s missed the Rust option and stumbled across the discussion about it)