Grokbase Groups Pig user July 2010
FAQ
All,



I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?



Sample code that is throwing errors:



myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");



error: invalid escape sequence.



Thanks,



Matt

Search Discussions

  • Anthony Urso at Jul 21, 2010 at 5:28 am
    You need to escape the backslashes, e.g. \\Q will be converted to \Q
    by javac before it is passed to Pig.
    On Tue, Jul 20, 2010 at 1:55 PM, Matthew Smith wrote:
    All,



    I am using pig embedded in Java and need to use matches in my pig job.
    However when I try to use escape characters in the pig line, the
    compiler complains. How do I use complex regex while embedding?



    Sample code that is throwing errors:



    myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
    '\Q34.21.12.*\E';");



    error: invalid escape sequence.



    Thanks,



    Matt

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedJul 20, '10 at 8:57p
activeJul 21, '10 at 5:28a
posts2
users2
websitepig.apache.org

2 users in discussion

Matthew Smith: 1 post Anthony Urso: 1 post

People

Translate

site design / logo © 2021 Grokbase