title: Hive Query Language RLIKE Query
body: <p>I'm trying to query with the following query</p>
  
  <pre><code>select * from mytable where mycolumn rlike '\d~[\d\.]+~\d~[\d\.]+~\d~2~(33|44)`
  </code></pre>
  
  <p>Here's some sample data in mytable</p>
  
  <pre><code>id | mycolumn
  ---|--------------------------------
  1  | 1~2.3.1~9~333.2~3~2~33
  2  | 1~1.4.3~4~233.2~4~2~44
  3  | 1~53.0.2785.124~4~6.0.1~5~2~33
  4  | 1~3~3~3~3~6~3
  </code></pre>
  
  <p>However, the result is always empty.</p>
  
  <p>As stated in <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF" rel="nofollow noreferrer">Hive Query Language Manual</a>, </p>
  
  <blockquote>
    <p>NULL if A or B is NULL, TRUE if any (possibly empty) substring of A matches the Java regular expression B, otherwise FALSE. For example, 'foobar' RLIKE 'foo' evaluates to TRUE and so does 'foobar' RLIKE '^f.*r$'.</p>
  </blockquote>
  
  <p>I tested the RegExp in Java, it works fine. Also tried to replace <code>\</code> with <code>\\</code>, and tried to replace <code>~</code> with <code>\~</code>, but there was no luck. </p>
  
  <p>The Java code I used to test is as follows</p>
  
  <pre><code>        Pattern p = Pattern.compile("\\d~[\\d\\.]+~\\d~[\\d\\.]+~\\d~2~(33|44)");
  </code></pre>
  
  <p>Could anyone tell what's wrong with the query? Thanks!</p>