-
Notifications
You must be signed in to change notification settings - Fork 255
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
Support .
in characters and negative numbers
#213
Conversation
.
in characters and negative numbers.
in characters and negative numbers
Codecov Report
@@ Coverage Diff @@
## master #213 +/- ##
=======================================
Coverage 88.18% 88.18%
=======================================
Files 24 24
Lines 1193 1193
=======================================
Hits 1052 1052
Misses 141 141
Continue to review full report at Codecov.
|
* add tests * allow `.` in string * allow negative int * allow negative numeric fix rstudio#212
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.
Looks good! Thanks for contributing.
Can you add a note in the NEWS file to the effect of
* Support negative numbers in numeric path segments
* Support `.` in string path segments
R/query-string.R
Outdated
re[type == "double" | type == "numeric"] <- "\\\\d*\\\\.?\\\\d*" | ||
re <- rep("[^/]+", length(type)) | ||
re[type == "int"] <- "-?\\\\d+" | ||
re[type == "double" | type == "numeric"] <- "-?\\\\d*\\\\.?\\\\d*" |
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.
Unrelated to your code, but I believe this is actually a bug, as it matches ""
as currently written. Do you mind swapping one of the \\\\d*
s with a \\\\d+
so that we can be sure that there's at least one digit in the string (as we do with int)?
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.
Ok, you're right. I'll use -?\d*\.?\d+
which would match e.g. .23
, which can be interesting, I guess.
Everything looks great except that the |
* don't match `.` * don't match empty string ""
Sorry about the |
Awesome! Thanks again. |
This is in relation to #212. I don't know how is your code coverage for tests, but it seems to pass. I was expecting to break more things, especially the
.
in characters since it was explicitly excluded. I'd be happy to change the pull request if needed.