code: protected List<String> filter(List<String> lines, String regexp, boolean invert) {
      List<String>	result;
      Pattern 		pattern;
  
      result  = new ArrayList<>();
      pattern = Pattern.compile(regexp);
  
      for (String line: lines) {
        if (invert) {
  	if (!pattern.matcher(line).matches())
  	  result.add(line);
        }
        else {
  	if (pattern.matcher(line).matches())
  	  result.add(line);
        }
      }
  
      return result;
    }
docs: Filters the list of strings with a regular expression.
  
  @param lines	the list to filter
  @param regexp	the regular expression to use
  @param invert	whether to invert the matching sense
  @return		the filtered list