code: public static boolean matchRegexOrEquals(final String inputSelector, final String item) {
          //see if inputSelector is wrapped in '/' chars
          String testregex = inputSelector;
          if (testregex.length()>=2 && testregex.indexOf('/') == 0 && testregex.lastIndexOf('/') == testregex.length() - 1) {
              testregex = inputSelector.substring(1, inputSelector.length() - 1);
              return item.matches(testregex.trim());
          }
          boolean match = false;
          try {
              match = item.matches(inputSelector.trim());
          } catch (PatternSyntaxException e) {
  
          }
          return match || inputSelector.trim().equals(item);
      }
docs: Tests whether the selector string matches the item, in three possible ways: first, if the selector looks like:
  "/.../" then it the outer '/' chars are removed and it is treated as a regular expression *only* and
  PatternSyntaxExceptions are not caught.  Otherwise, it is treated as a regular expression and any
  PatternSyntaxExceptions are caught. If it does not match or if the pattern is invalid, it is tested for string
  equality with the input.
  
  @param inputSelector test string which may be a regular expression, or explicit regular expression string wrapped
  in '/' characters
  @param item          item to test
  
  @return true if the item matches the selector