I am trying to extract the string only from the first square brackets starting from right to left
I have tried multiple approaches using str_match
and regexpr
but I couldn't make it.
c<-"Sens [91] [DRCol105]_Issuer[Risk\\Issuer]"
str_match(c,"\\[.*?\\]$")
OR
start.char<-regexpr("\\[*$",c)[1]+2
stop.char<-regexpr("\\]*$",c)[1]-1
substr(c,start.char,stop.char)
I want to extract everything that is inside the last square brackets. In this example, I would like to extract and save in a variable only "Risk\Issuer".
Aucun commentaire:
Enregistrer un commentaire