[Refactor] Cleanup runtime code generation

  + Use regexp in two test case.
  + Refactor the runtime condition build function