A simple question but I cannot solve it. I got a string like this mail address:
ma <- "something@somewhere.COM"
My goal is to get:
"something@somewhere.com"
So to put the to lower cases the part after the last dot. I've read this, this, so I tried:
gsub(".*\\.","\\L\\1", ma, perl = T)
[1] "COM" # nope
Also something like:
library(gsubfn)
options(gsubfn.engine = "R")
gsubfn(".*\\.", ~ tolower(x), ma)
[1] "something@somewhere.COM" # nope
I'm quite confused because it seems I can fetch the part I want to replace:
gsub(".*\\.","", ma)
[1] "COM"
But I cannot replace it properly. If you can give an explaination with the solution, I'll gladly appreciate it, regex is not my strongest feature.