Hitachi Vantara Pentaho Community Forums
Results 1 to 12 of 12

Thread: Regex to check for special char at the end of the string.

  1. #1

    Default Regex to check for special char at the end of the string.

    Hi,

    I want to remove non printing char from the end of the string using regex please help. how this can be done.

    Thanks,
    Nishank

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Name:  RIS.png
Views: 156
Size:  17.7 KB
    So long, and thanks for all the fish.

  3. #3

    Default

    Hi Marabu,

    Thanks for your quick response.


    How to identify a non printing character?

    Please
    Can you give me one example.
    And How to open a file in pentaho with non printing character is there any encoding required?

    Thanks,
    Nishank

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Quote Originally Posted by Nishank Goel View Post
    How to identify a non printing character?
    You asked the same question in your opening post, only more precise: How to (identify and) remove unprintable characters at the end of a string via Regular Expression.
    At least, that's what I understood.

    Quote Originally Posted by Nishank Goel View Post
    And How to open a file in pentaho with non printing character is there any encoding required?
    You should use the encoding the originator of the file expects you to use.
    So long, and thanks for all the fish.

  5. #5

    Default

    [(^\p{print}]*)$ this is the regex u have given me as a new user I dont know how to search for that particular non printing value.Is there some ascii value required? Can you give me example on this?

    Here we have a lot of encoding options are present. Which is the most suitable.

    Thanks,

  6. #6
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    That RE is ready to use

    And you don't just pick one of the available encodings, you ask the creator of the file which one you're supposed to use.
    So long, and thanks for all the fish.

  7. #7

    Default

    Getting error while using this RE:


    Unknown character property name {print} near index 11
    [(^\p{print}]*)$

    dnt know y?

  8. #8
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Would be so much easier to help, if you attach your experimental transformation - here's mine.
    I appended 0x7f 0x01 to the test string, and the RE removes both characters.


    PS: Every single character in a RE is significant, even the order, as one of my sons just mentioned ...

    PPS: I had to remove the 0x01 character from the test string so the transformation becomes loadable
    Attached Files Attached Files
    Last edited by marabu; 01-04-2016 at 05:28 AM. Reason: illegal character from attachment removed
    So long, and thanks for all the fish.

  9. #9

    Default

    I think you have attached blank ktr. Can you please recheck.

  10. #10

    Default

    And my non printing char is handling in input step using encoding UTF-16.

    Thanks for your continuous help over this issue.
    Last edited by Nishank Goel; 12-29-2015 at 08:44 AM. Reason: append change.

  11. #11

    Default

    Can you please recheck the regex it gives me error.

  12. #12
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    Though the character 0x01 in my test string worked in-memory, it didn't survive the round-trip to and from the filesystem.
    The attachment is now repaired and ready to run.
    Thanks for making me aware of this problem.
    So long, and thanks for all the fish.

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.