How to match a filename only from the beginning

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

How to match a filename only from the beginning Tue Nov 15, 2022 12:32 pm • by penguin
I'd like to match which only works if the match term is at the beginning of a filename (like in regexp: ^).

Use case: If a document is named 220816.mydocument.pdf, it should be rename to 2022-08-16.mydocument.pdf.

Unfortunately with the rule "Name matches date.filename and rename to date.filename.extension" with different date formats, documents like "Important docment draft - (220816).pdf" get renamed to 2022-08-16.).pdf.

Any ideas?
penguin
 
Posts: 2
Joined: Tue Nov 15, 2022 12:29 pm

If you use "matches", the pattern is anchored at the beginning and end. You need to specify a pattern which handles all characters in the name.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:If you use "matches", the pattern is anchored at the beginning and end. You need to specify a pattern which handles all characters in the name.


It'd be helpful as a feature to match only from the beginning.
penguin
 
Posts: 2
Joined: Tue Nov 15, 2022 12:29 pm

Just put the "anything" token at the end then.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support