A start...
_\d\d_\d\d_\d\d\d\d\_ == _2-digits (Mo)_2-digits (Da)_4-digits (Yr)_
You could put in tighter rules...
_[01]\d, only 12 months, so the first digit of the month has to be 0 or 1
_[0123]\d, only a maximum of 31 days, so the first digit of the day can only be 0 or 1 or 2 or 3
_20\d\d, depending on your range of possible years, maybe years starting with 20, so 2000 to 2099, would suffice
So it could be that something general like:
_\d\d_\d\d_\d\d\d\d\_ would work for you
or you might need something like:
_[01]\d_[0123]\d_20\d\d for further tightening
Both of the above would find: _03_21_2020_
---
1:RegEx
- Code: Select all
Match: (.*)(_\d\d_\d\d_\d\d\d\d\_)(.*)
Replace: \2\1--\3
- Code: Select all
somethinghere_04_28_2003_somthingelse -> _04_28_2003_somethinghere--somthingelse
Now that doesn't deal the the opening _, nor does it put your date in the correct order, but you can deal with that part afterwards - or you could change your regex: to deal with it initially.
Lets leave it relatively simple for now.
You can test with a basic matching regex: to see that your "date" is working as expected.
- Code: Select all
Match: (_\d\d_\d\d_\d\d\d\d\_)
Replace: \1
Every matched file will
display only the date part.
(Obviously you do not want to rename - at this point. It's just to help make it more obvious just what files would be affected, that no non-wanted files happen to end up being matched.)