code: public static boolean isVariable(String s) {
          if (s == null ||
                  s.length() < 3 ||
                  !s.startsWith("$") ||
                  !Character.isLetter(s.charAt(1))) {
              return false;
          }
  
          // check that the rest of the string is comprised of letters and digits only:
          for (int i = 2; i < s.length(); i++) {
              char c = s.charAt(i);
              if (!Character.isLetterOrDigit(c)) {
                  return false;
              }
          }
  
          return true;
      }
docs: Checks whether the String fits the template for a transformation variable -  $[a-zA-Z][a-zA-Z0-9]+
  e.g.  $a4, $Bd, $abcdef, etc
  
  @param s The string to test
  @return Whether it's a variable or not