<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Regex not giving same results as other regex engines in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Regex-not-giving-same-results-as-other-regex-engines/m-p/77171#M80750</link>
    <description>&lt;P&gt;Turned out to be pretty simple.&amp;nbsp; Hadoop (or at least Hive) prefers two backslashes like \\d rather than \d.&amp;nbsp; I ended up using this, which also requires one to four digits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;[(]\\d{1,4}[)]$&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 12:54:13 GMT</pubDate>
    <dc:creator>mattschutz</dc:creator>
    <dc:date>2018-07-19T12:54:13Z</dc:date>
    <item>
      <title>Regex not giving same results as other regex engines</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Regex-not-giving-same-results-as-other-regex-engines/m-p/76974#M80749</link>
      <description>&lt;P&gt;I'm executing the following query in Hive.&amp;nbsp; Many of my field values in my actual table look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ASDF (1)&lt;/P&gt;&lt;P&gt;abc 123 xyz (10)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc. etc.&amp;nbsp; I just want to replace any digits in parentheses at the end of a string with "x".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select 'SP0724_FA (1)' as str, regexp_replace(trim('&lt;SPAN&gt;SP0724_FA (1)&lt;/SPAN&gt;'), ' [(]\d+[)]$', 'x') as str_2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The online testing app at regex101.com matches this.&amp;nbsp; However, Hive returns the same value for str and str_2.&amp;nbsp; I would expect to see "&lt;SPAN&gt;SP0724_FAx" as the str_2 value.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Please note the&amp;nbsp;&lt;EM&gt;space&lt;/EM&gt; at the beginning of the regex pattern.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:28:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Regex-not-giving-same-results-as-other-regex-engines/m-p/76974#M80749</guid>
      <dc:creator>mattschutz</dc:creator>
      <dc:date>2022-09-16T13:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex not giving same results as other regex engines</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Regex-not-giving-same-results-as-other-regex-engines/m-p/77171#M80750</link>
      <description>&lt;P&gt;Turned out to be pretty simple.&amp;nbsp; Hadoop (or at least Hive) prefers two backslashes like \\d rather than \d.&amp;nbsp; I ended up using this, which also requires one to four digits.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;[(]\\d{1,4}[)]$&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 12:54:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Regex-not-giving-same-results-as-other-regex-engines/m-p/77171#M80750</guid>
      <dc:creator>mattschutz</dc:creator>
      <dc:date>2018-07-19T12:54:13Z</dc:date>
    </item>
  </channel>
</rss>

