Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Search and Replace CR and LF characters

  1. #1
    Join Date
    Apr 2008
    Posts
    1,771

    Smile Search and Replace CR and LF characters (Solved)

    Hi.
    I am trying to use "Replace in String" in order to search for a TAB charcater and replace it with CR and LF characters.

    In the step options I set "Use RegEx" as Y, Search as \t, Replace as \r\n.

    As a result the TAB is replaced, but with the characters "r" and "n".

    Is this a bug or am I doing something wrong?

    If I can use any other step to achieve the same, happy to follow suggestions.
    Thanks,
    Mick
    Last edited by Mick_data; 09-23-2011 at 04:30 AM. Reason: Spelling - Added Solved

  2. #2
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    Solved!!

    I have solved this using a "Modified JavaScript Value" step.
    var NewHeader = replace(Header,"\t","\n");

    Thanks,
    Mick

  3. #3
    Join Date
    Nov 2008
    Posts
    777

    Default

    In some cases you have to escape your special character sequences. In your original plan you might try using
    Code:
    \\r\\n
    pdi-ce-4.4.0-stable
    Java 1.7 (64 bit)
    MySQL 5.6 (64 bit)
    Windows 7 (64 bit)

  4. #4
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    Hi Darrell,
    I have tried that, but even if the Search was working and finding all tabs, the Replace part was inserting r and n characters, not CR and LF.
    Maybe it's a bug?

    Mick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.