I have string_a
, such that
string_a <- " ,A thing, something, . ."
Using regex
, how can I just retain "A thing, something"
?
I have tried the following and got such output:
sub("[[:punct:]]$|^[[:punct:]]","", trimws(string_a))
[1] "A thing, something, . ."