Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2756 Documentation for 0.11
  3. PIG-2905

Improve documentation around REPLACE

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • documentation
    • None

    Description

      Document how REPLACE uses a Java regex and link out to JDK docs describing reserved characters and escaping. From recent confusion on the users list:

      > String source = "[02/Aug/2012:05:01:17";
      > > String target ="[";
      > > String replaceWith = "";
      > > return source.replaceAll(source, target, replaceWith);
      
      
      > Note that Java String.replaceAll() takes a regular expression for the 2nd
      > parameter (i.e. target), and "[" is a special character. To use it as is,
      > you have to escape it, so in your Pig script, you should do:
      
      > REPLACE(date,'\\[','')
      

      Attachments

        1. PIG-2905.patch
          2 kB
          Cheolsoo Park

        Activity

          People

            cheolsoo Cheolsoo Park
            billgraham William W. Graham Jr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: