Q:

How do I create a case insensitive match in Pig?

Let's say I have the following file, students
John
Mary
Bill
Joe

I then load my data as follows:
a = load 'student' as (name:chararray);

I'd like for the results of b to be case insensitive: 
b = filter a by name matches ('.*john.*');

that is, to return one match, (John). I've tried setting the regex's mode using '?i.*john.*', but that does not seem to work.

A:

The reason is you forgot to close the bracket for case insensitive part.
The right syntax is '(?i).*john.*' 
Can you try this filter stmt?
b = filter a by name matches '(?i).*john.*';

