[ 
https://issues.apache.org/jira/browse/NIFI-5826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16708742#comment-16708742
 ] 

ASF GitHub Bot commented on NIFI-5826:
--------------------------------------

Github user ottobackwards commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3183#discussion_r238675406
  
    --- Diff: 
nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/util/RecordPathUtils.java
 ---
    @@ -39,4 +39,52 @@ public static String getFirstStringValue(final 
RecordPathSegment segment, final
     
             return stringValue;
         }
    +
    +    /**
    +     * This method handles backslash sequences after ANTLR parser converts 
all backslash into double ones
    +     * with exception for \t, \r and \n. See
    +     * <a 
href="file:../../../../../../../../../src/main/antlr3/org/apache/nifi/record/path/RecordPathParser.g">org/apache/nifi/record/path/RecordPathParser.g</a>
    --- End diff --
    
    What would help, is one or more clear, failing unit tests  against the 
current code that illustrate the problem.
    
    We have regex escape routines in more than one place, some for places 
without grammars ( replace text).  Where we _do_ have a grammar, the correct 
thing, or the preferred thing in a vacuum would be to have the grammar handle 
this.  It is centralized and more maintainable.  We may want to evaluate the 
regression as a community, based on the fix and the implications wrt 
maintainability and correctness.
    
    I would almost say that we would want to have discussion and review of both 
approaches.
    
    That would be my preference.



> UpdateRecord processor throwing PatternSyntaxException
> ------------------------------------------------------
>
>                 Key: NIFI-5826
>                 URL: https://issues.apache.org/jira/browse/NIFI-5826
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.7.1
>         Environment: Nifi in docker container
>            Reporter: ravi kargam
>            Assignee: Ed Berezitsky
>            Priority: Minor
>         Attachments: NIFI-5826_PR-3183.patch, 
> UpdateRecord_Config_Exception.JPG
>
>
> with replacement value strategy as Record Path Value,
> I am trying to replace square bracket symbol *[* with parenthesis symbol *(* 
> in my employeeName column in my csvReader structure with below syntax
> replaceRegex(/employeeName, "[\[]", "(")
> Processor is throwing following exception.
> RecordPathException: java.util.regex.PatternSyntaxException: Unclosed 
> character class near index 4 [\\[]
> It worked fine with other special characters such as \{, }, <, >, ;, _, "
> For double qoute ("), i had to use single escape character, for above listed 
> other characters, worked fine without any escape character. Other folks in 
> Nifi Slack tried \s, \d, \w, \. 
> looks like non of them worked.
> replace function worked for replacing [ and ]characters. didn't test any 
> other characters.
> Please address resolve the issue.
> Regards,
> Ravi
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to