Closed ajelhajj closed 8 months ago
You're correct. Our regular expression for field names is more restrictive than REDCap field name requirements.
I'll work on a regular expression that can permit as little as a single alpha character for a field name.
This will also affect the form name regex.
er, that didn't take as long as I thought.
REGEX_FIELD_NAME <- "(^[a-z]$|^[a-z][a-z,0-9]$|^[a-z](?!.*__.*)[a-z,0-9,_]+[a-z,0-9]$)"
field_name <- c("a", "ab", "a1", "a_1",
"a_", "_a", "a__1",
"1", "1a")
grepl(REGEX_FIELD_NAME, field_name, perl = TRUE)
[1] TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE
Thank you! Would it be possible to notify me when this is complete? I appreciate your help on this.
The pull request has been submitted. It's waiting on review and QA checks.
If you want to try it out ahead of that you can install it via
devtools::install_github("vubiostat/redcapAPI", ref = "333-importFile-newRecord")
This is now on the main branch: devtools::install_github("vubiostat/redcapAPI")
In this case, my project has a variable called [or] (short for operating room). On import with the API, I receive the following error message:
I receive the same error message when I replace this field name with [ro]:
Uploading these data dictionaries using the GUI works just fine.
I've also tried renaming this field [and] to see if the rejection could also be due to [or] having any particular privileges as an operator but the metadata is successfully imported through the API when [and] is a field name.