code: public static List<Object> parseCSVLine(String line, String separatorRegex) {
          List<Object> matches = new ArrayList<>();
          int currentPosition = 0;
          Matcher separatorMatcher = Pattern.compile("^" + separatorRegex).matcher(line);
          Matcher stringMatcher = Pattern.compile("^" + QUOTED_STRING_REGEX).matcher(line);
          Matcher doubleMatcher = Pattern.compile("^" + DOUBLE_REGEX).matcher(line);
          while (currentPosition < line.length()) {
              if (stringMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                  // Found String match
                  String token = line.substring(currentPosition + 1, stringMatcher.end() - 1);
                  matches.add(unescapeString(token));
                  currentPosition = stringMatcher.end();
              } else if (doubleMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                  // Found Double match
                  Double token = Double.parseDouble(line.substring(currentPosition, doubleMatcher.end()));
                  matches.add(token);
                  currentPosition = doubleMatcher.end();
              } else {
                  throw new IllegalArgumentException("Can't parse line: expected token at " + currentPosition + " (" + line + ")");
              }
  
              if (currentPosition < line.length()) {
                  if (!separatorMatcher.region(currentPosition, line.length()).useAnchoringBounds(true).find()) {
                      throw new IllegalArgumentException("Can't parse line: expected separator at " + currentPosition + " (" + line + ")");
                  }
                  currentPosition = separatorMatcher.end();
              }
          }
          return matches;
      }
docs: Parses a line of text representing comma separated values and returns
  the values themselves.
  
  @param line the line to parse
  @param separatorRegex the regular expression for the separator
  @return the list of values