def filter_column(col, expression)
      raise "Must call autofilter before filter_column" unless @autofilter_area

      col = prepare_filter_column(col)

      tokens = extract_filter_tokens(expression)

      unless tokens.size == 3 || tokens.size == 7
        raise "Incorrect number of tokens in expression '#{expression}'"
      end

      tokens = parse_filter_expression(expression, tokens)

      # Excel handles single or double custom filters as default filters. We need
      # to check for them and handle them accordingly.
      if tokens.size == 2 && tokens[0] == 2
        # Single equality.
        filter_column_list(col, tokens[1])
      elsif tokens.size == 5 && tokens[0] == 2 && tokens[2] == 1 && tokens[3] == 2
        # Double equality with "or" operator.
        filter_column_list(col, tokens[1], tokens[4])
      else
        # Non default custom filter.
        @filter_cols[col] = Array.new(tokens)
        @filter_type[col] = 0
      end

      @filter_on = 1
    end
def filter_column(col, expression)
      raise "Must call autofilter before filter_column" unless @autofilter_area

      col = prepare_filter_column(col)

      tokens = extract_filter_tokens(expression)

      unless tokens.size == 3 || tokens.size == 7
        raise "Incorrect number of tokens in expression '#{expression}'"
      end

      tokens = parse_filter_expression(expression, tokens)

      # Excel handles single or double custom filters as default filters. We need
      # to check for them and handle them accordingly.
      if tokens.size == 2 && tokens[0] == 2
        # Single equality.
        filter_column_list(col, tokens[1])
      elsif tokens.size == 5 && tokens[0] == 2 && tokens[2] == 1 && tokens[3] == 2
        # Double equality with "or" operator.
        filter_column_list(col, tokens[1], tokens[4])
      else
        # Non default custom filter.
        @filter_cols[col] = Array.new(tokens)
        @filter_type[col] = 0
      end

      @filter_on = 1
    end
Set the column filter criteria.

 The filter_column method can be used to filter columns in a autofilter
 range based on simple conditions.

 NOTE: It isn't sufficient to just specify the filter condition.
 You must also hide any rows that don't match the filter condition.
 Rows are hidden using the set_row() +visible+ parameter. WriteXLSX cannot
 do this automatically since it isn't part of the file format.
 See the autofilter.rb program in the examples directory of the distro
 for an example.

 The conditions for the filter are specified using simple expressions:

     worksheet.filter_column('A', 'x > 2000')
     worksheet.filter_column('B', 'x > 2000 and x < 5000')

 The +column+ parameter can either be a zero indexed column number or
 a string column name.

 The following operators are available:

     Operator        Synonyms
        ==           =   eq  =~
        !=           <>  ne  !=
        >
        <
        >=
        <=

        and          &&
        or           ||

 The operator synonyms are just syntactic sugar to make you more
 comfortable using the expressions. It is important to remember that
 the expressions will be interpreted by Excel and not by ruby.

 An expression can comprise a single statement or two statements
 separated by the +and+ and +or+ operators. For example:

     'x <  2000'
     'x >  2000'
     'x == 2000'
     'x >  2000 and x <  5000'
     'x == 2000 or  x == 5000'

 Filtering of blank or non-blank data can be achieved by using a value
 of +Blanks+ or +NonBlanks+ in the expression:

     'x == Blanks'
     'x == NonBlanks'

 Excel also allows some simple string matching operations:

     'x =~ b*'   # begins with b
     'x !~ b*'   # doesn't begin with b
     'x =~ *b'   # ends with b
     'x !~ *b'   # doesn't end with b
     'x =~ *b*'  # contains b
     'x !~ *b*'  # doesn't contains b

 You can also use * to match any character or number and ? to match any
 single character or number. No other regular expression quantifier is
 supported by Excel's filters. Excel's regular expression characters can
 be escaped using +~+.

 The placeholder variable +x+ in the above examples can be replaced by any
 simple string. The actual placeholder name is ignored internally so the
 following are all equivalent:

     'x     < 2000'
     'col   < 2000'
     'Price < 2000'

 Also, note that a filter condition can only be applied to a column
 in a range specified by the autofilter() Worksheet method.

 See the autofilter.rb program in the examples directory of the distro
 for a more detailed example.

 Note writeExcel gem supports Top 10 style filters. These aren't
 currently supported by WriteXLSX but may be added later.