Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Id usually use a regular expression with 3 capture groups; everything before the date, the date, and everything after the date. then I'd use an replace expression like $0$2$1 to combine what is before and after the date, and drop the date at the end. Commented Jan 21, 2022 at 18:09
  • 2
    please add a few sample file names to your Question for folks to work with. concrete is easier to tinker with than abstract. [grin]
    – Lee_Dailey
    Commented Jan 21, 2022 at 19:16
  • I added some sample file names. Thanks for your help! :)
    – schwadinho
    Commented Jan 22, 2022 at 20:08
  • if you use $_.name -match '(19|20\d{2})(\d{2})(\d{2})' or another regex of your choice - you will have the complete date in $Matches[0] and you can put it wherever you want
    – SimonS
    Commented Jan 22, 2022 at 20:26
  • @schwadinho - thank you for the added info. [grin] ///// now ... do you really want to combine those 3 input file names into one file name? if not ... please show what you want each to end up with. exactly what you want each of those demo file names to become.
    – Lee_Dailey
    Commented Jan 23, 2022 at 1:16