Skip to content

Conversation

stefanvanburen
Copy link
Member

  • Use re2 instead of re in more places
  • Simplify config
  • Simplify isinstance calls with tuples
  • Use comprehensions when reasonable

* Use re2 instead of re in more places
* Simplify config
* Simplify `isinstance` calls with tuples
* Use comprehensions when reasonable
@stefanvanburen stefanvanburen marked this pull request as ready for review September 12, 2025 13:34
@stefanvanburen stefanvanburen merged commit ee1a9d4 into main Sep 12, 2025
23 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/minor-tweaks branch September 12, 2025 14:33

# See https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
_email_regex = re.compile(
_email_regex = re2.compile(
Copy link
Member

Choose a reason for hiding this comment

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

This regular expression from the WHATWG group is "JavaScript- and Perl-compatible". Are we sure that switching to re2 doesn't change behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

we're running the protovalidate conformance tests and they still passed (relevant test cases). I'm not sure if we view those as exhaustive or more of a basic test of functionality.

In general, re2 is meant to be a drop-in replacement for re, and we aren't any of the documented PCRE-incompatible bits.

If there is a change in behavior, I'd still rather opt us towards using re2 since CEL expects that behavior. Happy to note it in release notes, though, thoughts?

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.

3 participants