Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Ujma
  •  Ujma
  • Paid support Topic Starter
2020-06-29T18:04:08Z
HI there,

From this file name : aaaa_abc_xyx_59_mno_asd_qwe_April_1_2020_06_18_1523.xlsx I want to extract "April_1", how can I do that I have tried substring but as month name is changing I am not able to use it and also I have tried REGEX grouping but how can I define group for month as month name is changing, can someone please help me with this?


Same problem with this file name : abcx_qwer_lmn_April_2_2020_xyz_1_2020_06_18_1523, I want to extract "April_2_2020" from this.


Thank You.
Ujma
Sponsor
Forum information
James Hagist
2020-06-30T11:51:51Z
In looking at your 2 examples it appears that the file names are not consistent? If so it is going to be impossible to us a regex or string manipulation to extract that date.

Have you thought about using a file watcher trigger with a file rename action? The idea is to monitor the FTP (etc) for new files dropping and then immediately rename them to something you can use?

A thought...
Ujma
  •  Ujma
  • Paid support Topic Starter
2020-06-30T15:13:11Z
These 2 files are process by 2 separate Jobs (there are multiple files) , so we can use regex for that.
bweston
2020-06-30T21:28:49Z
Based on your asking "how can I define group for month as month name is changing," I think this is probably more of a basic (intermediate?) regular expression question than a Visualcron question, although the Visualcron function usage wrapped around it is still of course relevant.

First example:

{REGEX(MatchGetGroup|aaaa_abc_xyx_59_mno_asd_qwe_April_1_2020_06_18_1523.xlsx|^(?:[^_]+_){6}([^_]+_[^_]+)(?:_[^_]+){4}\.xlsx$|1)}


Second example:

{REGEX(MatchGetGroup|abcx_qwer_lmn_April_2_2020_xyz_1_2020_06_18_1523|^(?:[^_]+_){3}([^_]+_[^_]+_[^_]+)(?:_[^_]+){6}$|1)}


Fantastic place to learn about regular expressions, because I don't intend to explain how the above works:

https://www.regular-expressions.info/ 


Scroll to Top