code: private static List<SecretRange> getAWSSecretPos(String text)
    {
      // log before and after in case this is causing StackOverflowError
      LOGGER.debug("pre-regex getAWSSecretPos");
  
      Matcher matcher = AWS_KEY_PATTERN.matcher(text);
  
      ArrayList<SecretRange> awsSecretRanges = new ArrayList<>();
  
      while (matcher.find())
      {
        int beginPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
  
        while (beginPos > 0 && beginPos < text.length() &&
               isBase64(text.charAt(beginPos)))
        {
          beginPos--;
        }
  
        int endPos = Math.min(matcher.end() + LOOK_AHEAD, text.length());
  
        while (endPos < text.length() && isBase64(text.charAt(endPos)))
        {
          endPos++;
        }
  
        if (beginPos < text.length() && endPos <= text.length()
            && beginPos >= 0 && endPos >= 0)
        {
          awsSecretRanges.add(new SecretRange(beginPos + 1, endPos));
        }
      }
  
      LOGGER.debug("post-regex getAWSSecretPos");
  
      return awsSecretRanges;
    }
docs: Find all the positions of aws key id and aws secret key.
  The time complexity is O(n)
  
  @param text the sql text which may contain aws key
  @return Return a list of begin/end positions of aws key id and
  aws secret key.