code: private static Transition makeTransitionToSelf(Pattern regex) {
      return new Transition(regex) {
        @Override
        Context computeNextContext(Context prior, Matcher matcher) {
          return prior;
        }
      };
    }
docs: A transition that consumes some content without changing state.