Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex matcher? #16

Open
davified opened this issue Feb 14, 2022 · 1 comment
Open

Regex matcher? #16

davified opened this issue Feb 14, 2022 · 1 comment

Comments

@davified
Copy link

Hi there, thanks for the great work on this library!

I was wondering if there's a way to do regex matching with the existing API?

# existing API
assert_that("1975-09-24", contains_string('1975-09-24'))

# is there a matcher that allows something like this?
assert_that("hello", matches_regex(r'[\d]{4}-[\d]{2}-[\d]{2}'))

Thanks!

@mwilliamson
Copy link
Owner

I don't see why not. If you take a look at the implementation of contains_string(), that should point you in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants