regex - Replace text between two special characters -


i have character vector as:

x<- "\t\t<taxon id=\"tot_f50\"/>" 

and

 y<- "tot_a01" 

and want replace tot_f50 text in y ("tot_a01").

do know how replace text between " , \ (i.e. "tot_f50) ?

try

 sub('(?<=").*(?=")', y, x, perl=true)  #[1] "\t\t<taxon id=\"tot_a01\"/>" 

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -