Hi everybody,
I have some difficulties to use regular expressions in R.
My problem is that I can't recover in a vector the data that I want to recover.
My R script is the next:
variable<-file("BestFitnessSBML_L1V2_exported.xml", open="r") while (length(line <- readLines(variable, n = 1))) { results<-grep('.*<parameter name=\"a1\" value=\"0.1\"/>.*', line, perl = TRUE, ignore.case = TRUE) print(results) } close(fichier)
When I print results I see that the regular expression has been found in my file.
I want to recover a1 and 0.1 in the regular expressions '.*<parameter name=\"a1\" value=\"0.1\"/>.*
'. Maybe someone can explain me how to recover it ?
Cordially,
Fabien
Nice example, I always end up doing things more complicated than it should with the XML package- this is simpler. I think you are missing closing square brackets after "//parameter" in both calls?