Topic
  • 5 replies
  • Latest Post - ‏2013-02-12T09:14:01Z by SystemAdmin
SystemAdmin
SystemAdmin
603 Posts

Pinned topic Regural Expression For Date Format

‏2013-02-12T05:52:55Z |
Hi,

I have a sample text file which contains date column and all the dates are in format dd/mm/yyyy. I want to create a view for date using regular expression in AQL. So could u tell me general regular expression for date field such that all dates in dd/mm/yyyy should be displayed.

Thanks in advance,
Lakshmi Goverdhan.
Updated on 2013-02-12T09:14:01Z at 2013-02-12T09:14:01Z by SystemAdmin
  • D7NU_rohit_haritash
    D7NU_rohit_haritash
    16 Posts

    Re: Regural Expression For Date Format

    ‏2013-02-12T05:57:49Z  
    Hi

    Please try this regex ;

    ^(((01-9|12\d|301)\/(013578|102)\/((19|2-9\d)\d{2}))|((01-9|12\d|30)\/(013456789|1012)\/((19|2-9\d)\d{2}))|((01-9|1\d|20-8)\/02\/((19|2-9\d)\d{2}))|(29\/02\/((16-9|2-9\d)(048|2468048|1357926)|((16|2468048|357926)00))))$
  • SystemAdmin
    SystemAdmin
    603 Posts

    Re: Regural Expression For Date Format

    ‏2013-02-12T06:05:34Z  
    Hi

    Please try this regex ;

    ^(((01-9|12\d|301)\/(013578|102)\/((19|2-9\d)\d{2}))|((01-9|12\d|30)\/(013456789|1012)\/((19|2-9\d)\d{2}))|((01-9|1\d|20-8)\/02\/((19|2-9\d)\d{2}))|(29\/02\/((16-9|2-9\d)(048|2468048|1357926)|((16|2468048|357926)00))))$
    Hi,

    I have tried with regex which you have sent but could not retrieve dates from text file.
  • SystemAdmin
    SystemAdmin
    603 Posts

    Re: Regural Expression For Date Format

    ‏2013-02-12T06:33:07Z  
    Although this simple one doesn't check for a valid date (i.e. date out of bounds like 31/2/1990) it should extract all dates in the format dd/mm/yyyy. It also extracts the individual items in groups (i.e. group 1 matched dd, group 2 matches mm and group 3matches yyyy).
    ^(0?1-9|10-31)\/(0?1-9|10-2)\/(\d{4})$
  • SystemAdmin
    SystemAdmin
    603 Posts

    Re: Regural Expression For Date Format

    ‏2013-02-12T06:47:12Z  
    Although this simple one doesn't check for a valid date (i.e. date out of bounds like 31/2/1990) it should extract all dates in the format dd/mm/yyyy. It also extracts the individual items in groups (i.e. group 1 matched dd, group 2 matches mm and group 3matches yyyy).
    ^(0?1-9|10-31)\/(0?1-9|10-2)\/(\d{4})$
    Hi,

    My text file consists of dates like 27/11/2008, 23/12/2008,17/12/2008, 2/3/2009. I can extract these dates using dict file but I dont want to do by using dict file. I want to extract using regular expression. So can u help me out.
  • SystemAdmin
    SystemAdmin
    603 Posts

    Re: Regural Expression For Date Format

    ‏2013-02-12T09:14:01Z  
    Hi,

    My text file consists of dates like 27/11/2008, 23/12/2008,17/12/2008, 2/3/2009. I can extract these dates using dict file but I dont want to do by using dict file. I want to extract using regular expression. So can u help me out.
    Hi,

    Finally I got succeeded in extracting dates of format dd/mm/yyyy from my text file by using
    "/((\d{2})|(\d))\/((\d{2})|(\d))\/((\d{4})|(\d{2}))/" regular expression. So we can now extract any number of dates of format dd/mm/yyyy from any text file.