public byte[] extractFilterSimpleExpression(byte[] filterStringAsByteArray,
    int filterExpressionStartOffset) throws CharacterCodingException {
    int quoteCount = 0;
    for (int i = filterExpressionStartOffset; i < filterStringAsByteArray.length; i++) {
      if (filterStringAsByteArray[i] == ParseConstants.SINGLE_QUOTE) {
        if (isQuoteUnescaped(filterStringAsByteArray, i)) {
          quoteCount++;
        } else {
          // To skip the next quote that has been escaped
          i++;
        }
      }
      if (filterStringAsByteArray[i] == ParseConstants.RPAREN && (quoteCount % 2) == 0) {
        byte[] filterSimpleExpression = new byte[i - filterExpressionStartOffset + 1];
        Bytes.putBytes(filterSimpleExpression, 0, filterStringAsByteArray,
          filterExpressionStartOffset, i - filterExpressionStartOffset + 1);
        return filterSimpleExpression;
      }
    }
    throw new IllegalArgumentException("Incorrect Filter String");
  }
Extracts a simple filter expression from the filter string given by the user
<p>
A simpleFilterExpression is of the form: FilterName('arg', 'arg', 'arg') The user given filter
string can have many simpleFilterExpressions combined using operators.
<p>
This function extracts a simpleFilterExpression from the larger filterString given the start
offset of the simpler expression
<p>
@param filterStringAsByteArray     filter string given by the user
@param filterExpressionStartOffset start index of the simple filter expression
@return byte array containing the simple filter expression
hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ParseFilter.java