hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Araujo <ara...@pythian.com>
Subject Re: How to extract multi-match in one line with regexp_extract function?
Date Tue, 10 Jun 2014 23:17:14 GMT
Unfortunately, regexp_extract only works with a single index.

If the fields in your line are delimited by some specific character, just
use the split function.
If not, you can use a combination of regexp_replace and split, like the
example below:

select split(regexp_replace('World Cup 2014', '(.*) (.*) (.*)',
'$1,$2,$3'), ',') from dual;
OK
["World","Cup","2014"]

Regards,
André


On 10 June 2014 20:11, Matouk IFTISSEN <matouk.iftissen@ysance.com> wrote:

> Hello,
>  I have a table that each record is in one line  (line), and I want to
> extract all patterns those match  in each line, the actuel comportement of
> the udf regexp_extract returns one occurence match!! but with
>  regexp_replace  the comportement is différent (replace all pattern match
> in line)
> how can I extract all patterns those  match in each line ??
>
> select (line,'*.(pattern_match).*, index_group) as matchs from my_table
>
>  Thanks by advance ;)
>
>
> --
>
> *Matouk IFTISSEN | Consultant BI & Big Data[image: http://www.ysance.com] *
> 24 rue du sentier - 75002 Paris - www.ysance.com <http://www.ysance.com/>
> Fax : +33 1 73 72 97 26
> *Ysance sur* :*Twitter* <http://twitter.com/ysance>* | Facebook
> <https://www.facebook.com/pages/Ysance/131036788697> | Google+
> <https://plus.google.com/u/0/b/115710923959357341736/115710923959357341736/posts>
| LinkedIn
> <http://www.linkedin.com/company/ysance> | Newsletter
> <http://www.ysance.com/nous-contacter.html>*
> *Nos autres sites* : *ys4you* <http://wwww.ys4you.com/>* | labdecisionnel
> <http://www.labdecisionnel.com/> | decrypt <http://decrypt.ysance.com/>*
>



-- 
André Araújo
Big Data Consultant/Solutions Architect
The Pythian Group - Australia - www.pythian.com

Office (calls from within Australia): 1300 366 021 x1270
Office (international): +61 2 8016 7000  x270 *OR* +1 613 565 8696   x1270
Mobile: +61 410 323 559
Fax: +61 2 9805 0544
IM: pythianaraujo @ AIM/MSN/Y! or araujo@pythian.com @ GTalk

“Success is not about standing at the top, it's the steps you leave behind.”
— Iker Pou (rock climber)

-- 


--




Mime
View raw message