code: @Nullable
      static String removeElExpressionBraces(@Nullable final String rule) {
          if(isEmptyWhitespace(rule)) {
              return null;
          }
          int startchar = 0; // inclusive
          int endchar = rule.length() - 1; // inclusive
  
          // garbage free trim()
          while(startchar < rule.length() && CharMatcher.WHITESPACE.matches(rule.charAt(startchar))) {
              ++startchar;
          }
          while(endchar > startchar && CharMatcher.WHITESPACE.matches(rule.charAt(endchar))) {
              --endchar;
          }
  
          if(rule.regionMatches(startchar, "${", 0, 2) && rule.charAt(endchar) == '}') {
              startchar += 2; // skip "${"
              --endchar; // skip '}'
          }
          // garbage free trim()
          while(startchar < rule.length() && CharMatcher.WHITESPACE.matches(rule.charAt(startchar))) {
              ++startchar;
          }
          while(endchar > startchar && CharMatcher.WHITESPACE.matches(rule.charAt(endchar))) {
              --endchar;
          }
          if(endchar < startchar ) {
              // null instead of empty string for consistency with 'isEmptyWhitespace' check at the beginning
              return null;
          }
          return rule.substring(startchar, endchar + 1);
      }
docs: Removes the expression braces "${ ... }" surrounding the rule.
  
  @param rule a given rule String.
  @return the given rule with the most outside braces stripped