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

Add option to escape raw strings in RegEx functions #191

Merged
merged 4 commits into from
Sep 18, 2022

Conversation

clausherther
Copy link
Contributor

@clausherther clausherther commented Sep 3, 2022

Closes #190

This PR adds functionality to allow the RegEx-based tests, such as expect_column_values_to_match_regex to accept unescaped/raw string patterns, by adding an optional is_raw parameter to the relevant tests. The default is False, i.e. regex strings are not automatically escaped.

For more context:
BigQuery: uses r'...' to mark the string as "raw"
Snowflake: uses $$..$$ to avoid needing escape characters (see https://docs.snowflake.com/en/sql-reference/functions-regexp.html#specifying-regular-expressions-in-dollar-quoted-string-constants)

@clausherther clausherther changed the title Attempt to escape raw strings in RegEx functions Add option to scape raw strings in RegEx functions Sep 14, 2022
@clausherther
Copy link
Contributor Author

clausherther commented Sep 14, 2022

@adamcunnington-mlg would love your eyes on this when you get a chance. Thanks!

@clausherther clausherther changed the title Add option to scape raw strings in RegEx functions Add option to escape raw strings in RegEx functions Sep 18, 2022
@clausherther
Copy link
Contributor Author

@adamcunnington-mlg would love your eyes on this when you get a chance. Thanks!

I'm going to go ahead and merge this for the upcoming release, since it's a non-breaking change.

@clausherther clausherther merged commit b21b13f into main Sep 18, 2022
@clausherther clausherther deleted the fix/issue-190-regex-matching branch September 18, 2022 16:21
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.

Tests that expect regex patterns are painful to use in BigQuery
1 participant