Skip to content

Provide an API for comparing the equivalence of two Regex values (while permitting false negatives) #1349

Description

@dolezvo1

I'd like to test a function that is supposed to output a regular expression, however I wasn't able to find a reasonably accurate way to do this, and I suspect there currently isn't any.

I'm aware that the reason for removal has been explained in #178. A workaround using r1.as_str() == r2.as_str() has been mentioned in both #313 and #364, however this does not appear to handle the cases where the regexes are compiled from the same string while using different options, i.e. has false positives in the context of "do two regexes return the same output for any possible input?".

A method that would not require the user of this library to maintain their own comparison code (i.e. r1.source_and_options_equals(r2)) would be preferable to a mechanism for exposing the compile options (i.e. r1.as_str() == r2.as_str() && r1.case_insensitive() == r2.case_insensitive() && ...).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions