Class RegexStringComparator

java.lang.Object
org.apache.hadoop.hbase.filter.ByteArrayComparable
org.apache.hadoop.hbase.filter.RegexStringComparator
All Implemented Interfaces:
Comparable<byte[]>

@Public public class RegexStringComparator extends ByteArrayComparable
This comparator is for use with CompareFilter implementations, such as RowFilter, QualifierFilter, and ValueFilter, for filtering based on the value of a given column. Use it to test if a given regular expression matches a cell value in the column.

Only EQUAL or NOT_EQUAL comparisons are valid with this comparator.

For example:

 ValueFilter vf = new ValueFilter(CompareOp.EQUAL, new RegexStringComparator(
   // v4 IP address
   "(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3,3}"
     + "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(\\/[0-9]+)?" + "|" +
     // v6 IP address
     "((([\\dA-Fa-f]{1,4}:){7}[\\dA-Fa-f]{1,4})(:([\\d]{1,3}.)"
     + "{3}[\\d]{1,3})?)(\\/[0-9]+)?"));
 

Supports Pattern flags as well:

 ValueFilter vf = new ValueFilter(CompareOp.EQUAL,
   new RegexStringComparator("regex", Pattern.CASE_INSENSITIVE | Pattern.DOTALL));
 
See Also: