regex - Removing contents of bracelets -
we have free text:
sal{del{rf}ghladfs}wds{w12rf}qq
output should be:
salwdsqq
please share various approaches if possible. example : lapply, gsub, for/while loop, grep
this works in r
string1 <- "sal{del{rf}ghla}dfs}wds{w12rf}qq" string2 <- gsub("{[^{}}]*}", "", string1, perl = true) string3 <- gsub("{.*}", "", string2, perl = true) string3
Comments
Post a Comment