fork download
  1. library(stringr)
  2. pattern <- "(?<=Levorotatory)(?:\\s*([SRI]|N/I)\\s*([^\\w\\s]*\\d*\\.?\\d+)){2}";
  3. x <- "Viscocity S <=0.25 S <=0.25 Levorotatory S <=21 R <=2.5 Giminal S <=1 S <=1"
  4. results <- str_match(x, pattern)[,-1]
  5. results
  6.  
Success #stdin #stdout 0.28s 42516KB
stdin
Standard input is empty
stdout
[1] "R"     "<=2.5"