fork(2) download
  1. v <- "((2-x+3)^2+(x-5+7)^10)^0.5"
  2. x <- grepl("^", v, fixed=TRUE)
  3. while(x) {
  4. v <- sub("(\\(((?:[^()]++|(?1))*)\\))\\^(\\d*\\.?\\d+)", "pow(\\2, \\3)", v, perl=TRUE);
  5. x = grepl("^", v, fixed=TRUE)
  6. }
  7. v
Success #stdin #stdout 0.22s 60752KB
stdin
Standard input is empty
stdout
[1] "pow(pow(2-x+3, 2)+pow(x-5+7, 10), 0.5)"