You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Cheolsoo Park (JIRA)" <ji...@apache.org> on 2012/09/04 20:19:07 UTC
[jira] [Assigned] (PIG-2905) Improve documentation around REPLACE
[ https://issues.apache.org/jira/browse/PIG-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cheolsoo Park reassigned PIG-2905:
----------------------------------
Assignee: Cheolsoo Park
> Improve documentation around REPLACE
> ------------------------------------
>
> Key: PIG-2905
> URL: https://issues.apache.org/jira/browse/PIG-2905
> Project: Pig
> Issue Type: Sub-task
> Reporter: Bill Graham
> Assignee: Cheolsoo Park
>
> 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:
> {noformat}
> > 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,'\\[','')
> {noformat}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira