I need to put a dot before a letter in this type of strings
name of data set: V2
6K102
62D102
627Z102
I would like to get this:
6.K102
62.D102
627.Z102
I am using this regex:
mutate(V2 = gsub("^[A-Z]",'\\.', V2))
If the string has to start with 1 or more digits followed by a char A-Z, you could use 2 capturing groups
^(\d+)([A-Z])
In the replacement use "\\1.\\2"
sub("^([0-9]+)([A-Z])", "\\1.\\2", V2)
you could use sub("([A-Z])",".\\1", V2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With