code: @Override
      public void prepareForRun() {
          // At this point we have all the tokens and now we construct the
          // complete regex and the list to use when extracting
          // We build the regexp so that it only extracts the needed parts.
  
          // Allocated buffer is a bit bigger than needed
          final StringBuilder regex = new StringBuilder(logFormatTokens.size() * 16);
  
          logFormatUsedTokens = new ArrayList<>();
  
          regex.append('^'); // Link to start of the line
          for (final Token token : logFormatTokens) {
              token.tokenWasUsed();
              if (token instanceof FixedStringToken) {
                  // Only insert the fixed part
                  regex.append(Pattern.quote(token.getRegex()));
              } else if (token.canProduceADesiredFieldName(requestedFields)) {
                  logFormatUsedTokens.add(token);
                  regex.append("(").append(token.getRegex()).append(")");
              } else {
                  regex.append("(?:").append(token.getRegex()).append(")");
              }
  
          }
          regex.append('$'); // Link to end of the line
  
          logFormatRegEx = regex.toString();
          LOG.debug("Source logformat : {}", logFormat);
          LOG.debug("Used regex       : {}", logFormatRegEx);
  
          // Now we compile this expression ONLY ONCE!
          logFormatPattern = Pattern.compile(logFormatRegEx);
  
          isUsable = true; // Ready!
      }
docs: --------------------------------------------