title: How To Remove non-alpha numeric, or non-numeric characters with Hive REGEXP_EXTRACT() Function
body: <p>I've been trying to figure out how to remove multiple non-alphanumeric or non-numeric characters, or return only the numeric characters from a string. I've tried:</p>
  
  <pre><code>SELECT
  regexp_extract('X789', '[0-9]', 0)
  FROM
  table_name
  </code></pre>
  
  <p>But it returns '7', not '789'.</p>
  
  <p>I've also tried to remove non-numeric characters using NOT MATCH syntax ^((?!regexp).)*$:</p>
  
  <pre><code>SELECT
  REGEXP_REPLACE('X789', '^((?![0-9]).)*$', '')
  FROM
  jav_test_ii
  </code></pre>
  
  <p>Can regexp_extract return multiple matches? What I'm really trying to do is clean my data to only contain numbers, or alphanumeric characters. This seems to help remove bad characters, but its not a range of characters like [0-9] is. regexp_replace(string, '�','')</p>
  
  <p>EDIT: The query below was able to return '7789', which is exactly what I was looking for.</p>
  
  <pre><code>SELECT
  regexp_replace("7X789", "[^0-9]+", "")
  FROM
  table_name
  </code></pre>