Hey @lhunsicker, glad you got it worked out. Another way of handling this with regular expressions would be to have made the pattern non-greedy by adding a ? to it:
teststr <- c("ragecut=Child, cohort=Ideal",
"ragecut=Child, cohort=PedEnbloc",
"ragecut=Child, cohort=PSeparate",
"ragecut=Teen, cohort=Ideal",
"ragecut=Teen, cohort=PedEnbloc",
"ragecut=Teen, cohort=PSeparate")
sub(".*=+?", "", teststr)
Produces:
[1] "Child, cohort=Ideal" "Child, cohort=PedEnbloc" "Child, cohort=PSeparate"
[4] "Teen, cohort=Ideal" "Teen, cohort=PedEnbloc" "Teen, cohort=PSeparate"
If your inputs are always this regular, another good way to handle this would've been by splitting the strings by delimiter but the regex approach is pretty tidy.