Conditional replace
Replace text around a target in file names
Conditional replacement helps when the part you want to change is defined by its position around a marker. It is useful for names that share separators, labels, or structured fragments.
Best for
Use this when plain find-and-replace is too broad and the replacement should only affect text before or after a target marker.
Rename examples
Replace prefix before marker
photo_20240517.jpg
image_20240517.jpg
Replace middle label
report-final-v3.docx
report-approved-v3.docx
Change anchored segment
clientA_invoice_001.pdf
clientB_invoice_001.pdf
Common use cases
- Change text before or after separators such as hyphens and underscores.
- Replace only the first, last, or all matching anchored segments.
- Update structured labels without touching the rest of the file name.
How to use it
- 1Choose the conditional replace rule.
- 2Set the target marker and the range to replace.
- 3Review the preview to confirm only the intended segment changes.
Limits and checks
- Use this when a stable marker defines the text range to replace.
- Check files where the marker is missing or appears more than once.
- Prefer regex when the target range is pattern-based instead of marker-based.
Common mistakes to avoid
- Assuming every file contains the same marker.
- Replacing around the first marker when the useful marker is later in the name.
- Using character counts on names with inconsistent structure.
FAQ
How is this different from normal replacement?
Normal replacement changes matching text directly. Conditional replacement first finds an anchor, then changes a defined area around it.
Can I replace text before a character?
Yes. You can target text before or after a marker and control how many characters are affected.