Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Looking for Regex to check DDMMYYCC.

  1. #1

    Default Looking for Regex to check DDMMYYCC.

    Hi All,

    I need regex to validate the date format which needs to be in format "ddmmyycc'
    where cc is century.


    Thanks in advance.

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

    Default

    There's a step for validating data: http://wiki.pentaho.com/display/EAI/Data+Validator
    -- Mick --

  3. #3
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by Nishank Goel View Post
    I need regex to validate the date format which needs to be in format "ddmmyycc'
    I've never seen a date format like that. more likely would be a date format of ddmmccyy
    Who would put a date like 20065019 meaning June 20, 1950? the century is not a distinct part of the year - it's PART of the year number.

  4. #4

    Default

    I am also looking first time.

    Yes, 20065019 meaning June 20, 19

    Here is one which I have created. Please have a look.

    ^(0[1-9]|[12][0-9]|3[01])(0[1-9]|1[012])\d\d(19|20)$


    Thanks

  5. #5
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by Nishank Goel View Post

    Here is one which I have created. Please have a look.

    ^(0[1-9]|[12][0-9]|3[01])(0[1-9]|1[012])\d\d(19|20)$
    That RegEx will allow 31029920 - or Feb 31st, 2099 ... Not something I think you want to allow.

    I would take it in as a string, rearrange it to a normal date format, then let PDI parse it.
    Formula step will rearrange the characters:LEFT([InStr];4)&RIGHT([InStr];2)&MID([InStr];5;2)

    Then you can use Select Values to change the metadata from String to Date. It will then validate that the dates are really valid.
    Last edited by gutlez; 10-06-2015 at 10:25 AM.

Tags for this Thread

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.