Hi folks,
I am trying to get the datetime part from a list of files
names can be like given below :
a_b_c_02022018122555.txt
a_b_c_02_2345_02022018122555_123.txt
abc02022019122555.txt
abc_pqr_02022019.txt
abc_pqr_02022019_123.txt
I need a common regex to retrieve output as follows . Basically this is equivalent to getting if(14digit_timestamp) then (get 14digit_timestamp) else (8digit_timestamp). I was trying something like (.*)([0-9]{14})[0-9]{14}|[0-9]{8}.* and cant make it work..
02022018122555
02022018122555
02022019122555
02022019
02022019
I am trying to get the datetime part from a list of files
names can be like given below :
a_b_c_02022018122555.txt
a_b_c_02_2345_02022018122555_123.txt
abc02022019122555.txt
abc_pqr_02022019.txt
abc_pqr_02022019_123.txt
I need a common regex to retrieve output as follows . Basically this is equivalent to getting if(14digit_timestamp) then (get 14digit_timestamp) else (8digit_timestamp). I was trying something like (.*)([0-9]{14})[0-9]{14}|[0-9]{8}.* and cant make it work..
02022018122555
02022018122555
02022019122555
02022019
02022019