Skip to content

Provide a library function/method for converting a glob to an uncompiled regex string. #11

@kwlzn

Description

@kwlzn

currently, the way to get a regex string for a given gitignore-style glob is:

>>> pathspec.GitIgnorePattern('/dist/').regex.pattern
'^dist/.*$'

which incurs the glob->regex translation inside GitIgnorePattern.__init__ which in turn calls RegexPattern.__init__ which automatically compiles the regex.

for the simple case of just wanting to convert a glob into a non-compiled regex string, it'd be great to have a utility function/method that could both be used inside GitIgnorePattern.__init__ and outside as part of the public API.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions