1
0

update to gerrit metadata extraction regex

This commit is contained in:
Matthew Gaughan 2025-09-16 11:37:46 -07:00
parent bb67fea96b
commit e2413ed955

View File

@ -11,10 +11,12 @@ library(dplyr)
gerrit_extracted_df <- gerrit_df |>
mutate(
jsonfixed = gsub("(?<=\\{|\\[|, )'(\\w+?)'(?=\\s*:)", '"\\1"', selected_gerrit_results, perl = TRUE),
jsonfixed = gsub(":(\\s*)'(.*?)'(?=[}\\],])", ':\\1"\\2"', jsonfixed, perl = TRUE),
jsonfixed = gsub("(?<=[:\\[,\\{])\\s*'([^']*)'\\s*(?=[,\\}\\]])", '"\\1"', jsonfixed, perl = TRUE),
expandedjsonlist = lapply(jsonfixed, fromJSON)
gerrit_status = str_match(selected_gerrit_results, "'status':\\s*'([^']*)',\\s*'reviewer")[,2],
owner_email = str_match(selected_gerrit_results, "'owner_email':\\s*'([^']*)'")[,2],
written_url_in_message = str_match(selected_gerrit_results, "'written_url_in_message':\\s*'([^']*)'")[,2],
code_insertions = as.integer(str_match(selected_gerrit_results, "'code_insertions':\\s*(\\d+)")[,2]),
code_deletions = as.integer(str_match(selected_gerrit_results, "'code_deletions':\\s*(\\d+)")[,2]),
reviewer_count = as.integer(str_match(selected_gerrit_results, "'reviewer_count':\\s*(\\d+)")[,2])
)
# TODO select