You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by ROHIT LADDHA <ro...@gmail.com> on 2014/02/27 13:17:38 UTC

pig REGEX_EXTRACT_ALL

Hi,

how REGEX_EXTRACT_ALL works? When I use REGEX_EXTRACT, its gives the
expected result but REGEX_EXTRACT_ALL gives empty result most of the time
which not expected.

Regards
Rohit

Re: pig REGEX_EXTRACT_ALL

Posted by ROHIT LADDHA <ro...@gmail.com>.
Yeah sure.

'resultData' file contains

lakers nba.com 1
lakers espn.com 2
kings nhl.com 1
kings nba.com 2


4 rows, 3 columns seperated by '\t'

commands are

p = load 'resultData' using TextLoader AS (line:chararray);
q = foreach p generate flatten (REGEX_EXTRACT (line, '(.com).*',1 ) );
r = foreach p generate flatten (REGEX_EXTRACT_ALL (line, '(.com)' ) );


output is analysed by 'dump' command
output of q is same as as expexted that is

(.com)
(.com)
(.com)
(.com)

but output of r is empty tuples

()
()
()
()

which is not expected. r should be same as q.



On Thu, Feb 27, 2014 at 5:57 PM, Nitin Pawar <ni...@gmail.com>wrote:

> can you give an example on what's the input and what's your code?
>
>
>
>
> On Thu, Feb 27, 2014 at 5:47 PM, ROHIT LADDHA <ro...@gmail.com>
> wrote:
>
> > Hi,
> >
> > how REGEX_EXTRACT_ALL works? When I use REGEX_EXTRACT, its gives the
> > expected result but REGEX_EXTRACT_ALL gives empty result most of the time
> > which not expected.
> >
> > Regards
> > Rohit
> >
>
>
>
> --
> Nitin Pawar
>

Re: pig REGEX_EXTRACT_ALL

Posted by Nitin Pawar <ni...@gmail.com>.
can you give an example on what's the input and what's your code?




On Thu, Feb 27, 2014 at 5:47 PM, ROHIT LADDHA <ro...@gmail.com> wrote:

> Hi,
>
> how REGEX_EXTRACT_ALL works? When I use REGEX_EXTRACT, its gives the
> expected result but REGEX_EXTRACT_ALL gives empty result most of the time
> which not expected.
>
> Regards
> Rohit
>



-- 
Nitin Pawar