1

I have a file the name is: security_public_storage_account_performance_10_1_2021_to_10_31_2021.xls I am trying to use regex to pull out both those dates in the file name. I am using

Start Date: REGEXP_REPLACE(_FILE_NAME_, '^.(\d{1,2})(\d{1,2})(\d{4})to(\d{1,2})(\d{1,2})_(\d{4}).$', '$1/$2/$3')

End Date: REGEXP_REPLACE(_FILE_NAME_, '^.(\d{1,2})(\d{1,2})(\d{4})to(\d{1,2})(\d{1,2})_(\d{4}).$', '$4/$5/$6')

The result for both is reflecting: 10_1_2021_to_10_31_2021.xls

This is SQL. How can I get these dates to be separated to show 2 separate dates instead of just the 2 dates showing as 1?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563

0 Answers0