Skip to content

Support case-insensitive regex patterns #3289

@gurry

Description

@gurry

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions