-
Notifications
You must be signed in to change notification settings - Fork 52
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
Update variable regex to support hyphens #503
Merged
pietern
merged 7 commits into
databricks:main
from
stikkireddy:fix/support-hyphens-interpolate
Jun 23, 2023
Merged
Update variable regex to support hyphens #503
pietern
merged 7 commits into
databricks:main
from
stikkireddy:fix/support-hyphens-interpolate
Jun 23, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pietern
reviewed
Jun 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT?
…ctive Co-authored-by: Pieter Noordhuis <pcnoordhuis@gmail.com>
pietern
changed the title
added more complex regex for supporting hyphens
Update variable regex to support hyphens
Jun 23, 2023
pietern
approved these changes
Jun 23, 2023
Merged
pietern
added a commit
that referenced
this pull request
Jun 28, 2023
## Changes CLI: * Add --absolute flag for ls command ([#508](#508)). * Add dbfs scheme prefix to paths in cp command output ([#516](#516)). * Add provider detection to the repos create command ([#528](#528)). * Added configure-cluster flag for auth login ([#500](#500)). * Added prompts for Databricks profile for auth login command ([#502](#502)). * Allow specifying repo by path for repos commands ([#526](#526)). * Decode contents by default in workspace export command ([#531](#531)). * Fixed jobs create command to only accept JSON payload ([#498](#498)). * Make local files default for fs commands ([#506](#506)). * Remove \r from new line print statments ([#509](#509)). * Remove extra call to filer.Stat in dbfs filer.Read ([#515](#515)). * Update alerts command integration test ([#512](#512)). * Update variable regex to support hyphens ([#503](#503)). Bundles: * Add DATABRICKS_BUNDLE_TMP env variable ([#462](#462)). * Update Terraform provider schema structs ([#504](#504)). Dependencies: * Bump github.com/databricks/databricks-sdk-go from 0.9.1-0.20230614092458-b5bbc1c8dabb to 0.10.0 ([#497](#497)). Internal: * Use direct download for workspace filer read ([#514](#514)).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Modified interpolation logic to use:
\$\{([a-zA-Z]+([-_]*[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]*[a-zA-Z0-9]+)*)*)\}
Edit: Suggested by @pietern
\$\{([a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*)*)\}
to be more selective and not allow consequent hyphens or underscores to make the keys more readable.Explanation:
${
and ends with}
.
[a-zA-Z]
; no numbers, hyphens or underscores.[a-zA-Z0-9]
no hyphens or underscoresThis change allows the current interpolation to be more permissive.
Note it does break backwards compatibility because
[a-zA-Z] != [\w]
.\w
includes alphanumeric and underscores.\w = [a-zA-Z0-9_]
Tests
There are two tests with examples of valid and invalid interpolation and a test to validate expansion.