File Mover Blog

July 6, 2025

Having 10 or more groups and want to reference group 1 in RegEx

Having 10 or more groups and want to reference group 1 in RegEx

Q: This regex rename is under the unzip…

My intent is to fix the lack of a leading zero in the MM field of the file name but limagito is seeing it as capture group 10, not capture group 1 with a zero after it.
Escaping the zero didn’t work either. Is there something else i could have done?
I eventually hard coded the 2025, because hopefully this is a 1 off error anyway.

limagito file mover reference group 1 in RegEx

A: You’ve identified a classic regex gotcha! When you have 10 or more groups and want to reference group 1 followed by a literal “0”, the regex engine interprets `\10` as group 10 instead of group 1 + “0”.

Here is a solution to solve this: Use \g<n> syntax (most regex flavors)
# Instead of: \10
# Use: \g<1>0

If you need any help with this ‘reference group 1 in RegEx’ question, please let us know.

Best Regards,

Limagito Team

#regex #managedfiletransfer #filetransfer #filemanagement

By Limagito-Team Rename Share:
SEARCH