Skip to content

Conversation

@em-baggie
Copy link
Collaborator

@em-baggie em-baggie commented Jun 22, 2025

Alternative method, a lot simpler.

Closes #93

Copy link
Collaborator

@oylenshpeegul oylenshpeegul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

I was confused for a bit why there wasn't a change to codelist_options.rs to remove the custom regex, but of course that was just added in #97 and this bypasses that entirely.

I like how LazyLock being in the standard library means we do not have to add anything to [dev-dependencies] or whatever.

Copy link
Collaborator

@CarolineMorton CarolineMorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments about tests. Well done Emma this is much simpler and easier to understand. Let's get these changes checked in and close the other PR.

@em-baggie em-baggie requested a review from CarolineMorton June 26, 2025 07:12
Copy link
Collaborator

@CarolineMorton CarolineMorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Emma, this looks great, thanks. Let;s get this merged in.

Comment on lines +305 to +307
codelist.add_entry("A11", "Valid test code")
codelist.validate_codes("^A")
codelist.add_entry("B112", "Invalid test code")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks

@CarolineMorton CarolineMorton merged commit 410377a into main Jun 26, 2025
7 checks passed
@CarolineMorton CarolineMorton deleted the add_custom_validation_2 branch June 26, 2025 09:10
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

Successfully merging this pull request may close these issues.

Add the ability to pass a regular expression into validate() for custom validation

4 participants