rust-bindgen
rust-bindgen copied to clipboard
Support case-insensitive regex patterns
Builder methods allowlist_* and blocklist_* do not support case-insensitive regex patterns like ((?i).*foo) (note the (?i) modifier).
If you try to use them:
let bindings = bindgen::Builder::default()
.header("myheader.h")
.allowlist_file("(?i).*foo") // case-insensitive regex
.generate()
you get errors like this:
regex parse error:
^((?i).*foo)$
^
error: Unicode-aware case insensitivity matching is not available (make sure the unicode-case feature is enabled)
As the error states, the unicode-case feature of the regex crate is required for such patterns. Unfortunately bindgen neither enables this feature nor expose a way to enable it.
A possible work around is for the user to to take a direct dependency on regex and configure the feature themselves. That works but is awkard. Ideally bindgen should provide native support.
To my knowledge this limitation is also not documented anywhere.