The regex [^a-z0-9%*][a-z0-9%]{3,}(?=[^a-z0-9%*]) is not supported by Rust's default regex create due to positive look-ahead (?=):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regex parse error:
[^a-z0-9%*][a-z0-9%]{3,}(?=[^a-z0-9%*])
^^^
error: look-around, including look-ahead and look-behind, is not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)
What's the optimal way to rewrite it or make it working?
I've found fancy-regex crate but i'd like to avoid using both crates (or prefer fancy over default) just for one missing feature.
PS. here it is at least one expected matches example.
Place your current matching pattern into a capture group, and also match (but do not capture) the term currently inside the lookahead: