-
Notifications
You must be signed in to change notification settings - Fork 789
Update Regex to Support All ASDF Versions for the supported distributions in tool-versions File #767
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
base: main
Are you sure you want to change the base?
Update Regex to Support All ASDF Versions for the supported distributions in tool-versions File #767
Changes from 1 commit
4dcdbcd
7872dcf
0bd6823
cb386ac
368c98a
b0d0904
cfefdbc
a35ec49
88a3812
cda1881
4482507
c981c0e
250752c
8fa56ab
2ccd746
f4d4543
684674e
baaaebd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,7 @@ export function getVersionFromFileContent( | |
const versionFileName = getFileName(versionFile); | ||
if (versionFileName == '.tool-versions') { | ||
javaVersionRegExp = | ||
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(\.\d+)?(-ea(\.\d+)?)?(\.LTS)?)$/m; | ||
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\S+)?(\.\d+)?(-ea(\.\d+)?)?(\.LTS)?)$/m; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the I tested this regex against the output of Already matched, still match
Newly matched
Still not matched
Notable causes of remaining misses are:
I hope that's helpful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, in case you want to repeat the analysis, I used jq. The regex engine is close enough for one like this.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @annettejanewilson, Thank you again for your thorough analysis and the detailed feedback. We’ve updated the pattern to correctly match all of the Java versions in your test suite, with a few clearly documented exceptions:
Rather than overfitting the regex to cover every edge case, we’ve prioritized maintainable support for standard and semver-like formats while explicitly documenting exceptions for transparency. Thanks again for your valuable input and please don’t hesitate to share more insights or suggestions! |
||
} else { | ||
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; | ||
} | ||
|
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.
The complex regex pattern lacks documentation explaining its purpose and the various parts it matches. Add comments describing what each component captures.
Copilot uses AI. Check for mistakes.