Skip to content

Treatment of regexes #23

@robertodr

Description

@robertodr

Defining a filter based on regexes, i.e. using re/from_re/to_re, assumes a string
is passed in. runtest then uses re.compile on the string to create the regex object.
I think this should be extended to allow passing a regex object (that is, the result of re.compile)
directly.
As as example, to match "Foo" case-insensitive the following currently works:

regex = r'(?i)Foo'
get_filter(re=regex, ...)

see: https://docs.python.org/3/library/re.html#regular-expression-syntax
The following does not, but I think it should:

regex = re.compile('Foo', re.I)
get_filter(re=regex, ...)

especially because passing flags modifying regexes looks less obscure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions