Regex finds a structure, not one literal name
IMG_1234.jpg and IMG_5678.jpg contain different digits but share the structure “IMG_ followed by numbers.” A regular expression matches that structure.
Only My Kit applies JavaScript regex to the base name without its extension. The global flag means every match inside a name is replaced.
Start with prefixes, spaces and trailing numbers
These five common examples use an empty Replace value to delete a match when needed.
Remove IMG_ at the start
IMG_001.jpg
IMG_002.jpg
IMG_003.jpg^IMG_Empty string001.jpg
002.jpg
003.jpg^ anchors the match to the start of the base name.
Remove the Screenshot_ prefix
Screenshot_2026-08-17.png
Screenshot_2026-08-18.png^Screenshot_Empty string2026-08-17.png
2026-08-18.pngOnly names starting with this exact prefix change.
Replace spaces with underscores
summer vacation 001.jpg
summer vacation 002.jpg\s+_summer_vacation_001.jpg
summer_vacation_002.jpg\s+ matches one or more consecutive whitespace characters.
Remove a trailing (1) or (2)
report (1).pdf
report (2).pdf
report (17).pdf\s*\(\d+\)$Empty stringreport.pdf
report.pdf
report.pdfThe optional space and parenthesized number are matched only at the end. Duplicate outputs are flagged.
Change the final number before the extension
event_001.jpg
session_42.jpg\d+$finalevent_final.jpg
session_final.jpgRegex runs on the base name, so $ refers to the point before .jpg.
Reformat dates and combine alternatives
Captured values can be reused and several prefixes can share one pattern. Test a small copied set first.
Reformat a date
20260817_photo.jpg
20260818_photo.jpg^(\d{4})(\d{2})(\d{2})_$1-$2-$3_2026-08-17_photo.jpg
2026-08-18_photo.jpgCaptured year, month and day are reused with JavaScript replacement tokens $1, $2 and $3.
Normalize repeated whitespace
product image 01.jpg\s+_product_image_01.jpgAny run of whitespace becomes one underscore.
Remove one of several prefixes
KakaoTalk_trip.jpg
DSC_1042.jpg
Screenshot_home.png
IMG_7788.jpg^(KakaoTalk_|DSC_|Screenshot_|IMG_)Empty stringtrip.jpg
1042.jpg
home.png
7788.jpgThe | inside parentheses means one of these alternatives.
Find every number run
photo_12_take_3.jpg\d+Nphoto_N_take_N.jpgThe tool uses the global flag, so every digit run in the base name changes.
Remove a trailing _copy
proposal_copy.docx
photo_copy.jpg_copy$Empty stringproposal.docx
photo.jpg$ limits the match to the end instead of changing _copy in the middle.
Beginner regex cheat sheet
A dot means any character in regex; use \. for a literal period. .* is deliberately broad and should usually have a clear boundary around it.
| Expression | Meaning |
|---|---|
| ^ | Start of the base name |
| $ | End of the base name |
| \d | One digit |
| \d+ | One or more digits |
| \s | A whitespace character |
| \s+ | One or more whitespace characters |
| . | Any single character |
| .* | Any number of characters |
| () | Group a matched part |
| $1 | Reuse the first group |
| \. | A literal period |
Extensions and capture groups in this tool
The tool splits a name at the final period and runs regex only on the base. In report (1).pdf, $ is therefore the position after (1), before .pdf.
JavaScript String.replace allows $1 and $2 to reuse captured groups. Patterns are created with the g flag, so all matches change.
The extension field only renames the extension text. Calling a JPG file .webp does not convert its image data.
Always inspect the preview before applying
One rule affects every selected file. Broad patterns such as \d+ or .* can catch product and version numbers as well as the date you intended.
An invalid pattern blocks the download. Duplicate output names also trigger a warning and disable ZIP creation.
- Original files are not renamed in place; renamed copies go into a ZIP.
- Test mixed file sets in smaller groups.
- Make the pattern narrower if any preview row is unexpected.
- Removing (1) and (2) from identical base names creates a collision.
Start from an example instead of memorizing syntax
File Renamer provides a regex toggle, quick help and a Before/After preview for every file. Copy the closest example and change only the literal prefix first.
The downloaded ZIP contains renamed copies while the source files remain untouched.
FAQ
- Does regex include the extension?
- No. The current tool separates the final extension and applies regex to the base name.
- Does $1 replacement work?
- Yes. The tool uses JavaScript replacement syntax, including $1, $2 and later capture groups.
- Are original files renamed?
- No. The browser previews names and packages copied file data under the new names in a ZIP.