Improve yr_re_execute with a non-recursive algorithm