Open
Description
Feature Request
Please add a method regex::Regex::get_config
which would expose the data from regex_automata::meta::Regex::get_config
.
Why?
The main reason is to support full round-trips when serializing regexes. In particular, the serde_regex
crate (officially recommended by regex
) is not able to preserve config flags such as case insensitivity.
The current situation is such that neither regex_automata::meta::Regex
nor regex::Regex
are suitable for round-tripping serialization.
regex_automata::meta::Regex
stores the internal impl and config, and even makes the config readable; but it does not keep track of the input patternregex::Regex
is a wrapper around the previous struct, which also keeps track of the input pattern; however it does not provide any method to read the config
Alternatives
An alternative would be for regex_automata::meta::Regex
to provide a way to recover the input pattern, but it feels a bit backwards. regex::Regex
already has all the data available, so exposing it to enable lossless serialization feels like a better approach.