Here you can find the source of getUsedInputs(String expression)
public static String getUsedInputs(String expression)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static String getUsedInputs(String expression) { List<String> usedInputsList = new ArrayList<>(); Pattern pattern = Pattern.compile("\\w+"); Matcher matcher = pattern.matcher(expression); String currentString;//from w ww .j a v a 2 s. c om while (matcher.find()) { currentString = matcher.group(); if (!usedInputsList.contains(currentString)) usedInputsList.add(currentString); } Collections.sort(usedInputsList); return String.join(" ", usedInputsList); } }