<?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 How to remove '[' from a column in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200746#M59518</link>
    <description>&lt;P&gt;Hi.. Is there a way to find '[' from a column.&lt;/P&gt;&lt;P&gt;I have a field which has a value of '28 May 2016[3]' and I need the output as '28 May 2016' I tried with regexp and split but while using '[' im facing an error. Also please dont suggest substr because my value will change and it will contain  like '7 September 2015[456]' , '2 Sep 2014[34]'. Is there any way out in hive?&lt;/P&gt;</description>
    <pubDate>Sat, 15 Apr 2017 21:36:02 GMT</pubDate>
    <dc:creator>balavignesh_nag</dc:creator>
    <dc:date>2017-04-15T21:36:02Z</dc:date>
    <item>
      <title>How to remove '[' from a column</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200746#M59518</link>
      <description>&lt;P&gt;Hi.. Is there a way to find '[' from a column.&lt;/P&gt;&lt;P&gt;I have a field which has a value of '28 May 2016[3]' and I need the output as '28 May 2016' I tried with regexp and split but while using '[' im facing an error. Also please dont suggest substr because my value will change and it will contain  like '7 September 2015[456]' , '2 Sep 2014[34]'. Is there any way out in hive?&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2017 21:36:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200746#M59518</guid>
      <dc:creator>balavignesh_nag</dc:creator>
      <dc:date>2017-04-15T21:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove '[' from a column</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200747#M59519</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/12437/balavigneshnagamuthuvenkatesan.html"&gt;Bala Vignesh N V&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Actually you can still use substr, but first you need to find your "[" character with instr function. As such, you would substr from the first character to the instr position -1. For special characters you have to use an escape character.&lt;/P&gt;&lt;P&gt;Look here for instr and substr examples: &lt;A href="http://hadooptutorial.info/string-functions-in-hive/#INSTRING" target="_blank"&gt;http://hadooptutorial.info/string-functions-in-hive/#INSTRING&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is how is done in all SQL-like, e.g. Oracle, SQL Server, MySQL etc. &lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2017 09:01:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200747#M59519</guid>
      <dc:creator>cstanca</dc:creator>
      <dc:date>2017-04-16T09:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove '[' from a column</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200748#M59520</link>
      <description>&lt;P&gt;Hi &lt;A href="https://community.hortonworks.com/questions/96923/how-to-remove-from-a-column.html#"&gt;@Constantin Stanca&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks. At present im using the combination of substr and instr only. Just wanted to know if there are any other possibilities. My current solution is Substr('28 May 2016[35]',1,instr('28 May 2016[35]','[' - 1 ))&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2017 18:51:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200748#M59520</guid>
      <dc:creator>balavignesh_nag</dc:creator>
      <dc:date>2017-04-16T18:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove '[' from a column</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200749#M59521</link>
      <description>&lt;P&gt;You can use one of the following&lt;/P&gt;&lt;PRE&gt;regexp_replace(s, "\\[\\d*\\]", "");
regexp_replace(s, "\\[.*\\]", "");&lt;/PRE&gt;&lt;P&gt;The former works only on digits inside the brackets, the latter on any text. Escapes are required because both square brackets ARE special characters in regular expressions. For example:&lt;/P&gt;&lt;PRE&gt;hive&amp;gt; select regexp_replace("7 September 2015[456]", "\\[\\d*\\]", "");
7 September 2015&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Apr 2017 23:52:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-remove-from-a-column/m-p/200749#M59521</guid>
      <dc:creator>pminovic</dc:creator>
      <dc:date>2017-04-16T23:52:29Z</dc:date>
    </item>
  </channel>
</rss>

