Regexp in Batch Rename
Posted: 22 Jul 2013, 16:42
I just happened to stumble uppon a strage behaviour in the Batch Rename plugin.
I had a couple of files with extensions resembling a GUID, something like
I wanted to remove those extensions and created a regular expression in the Search for field with the Replace with field being empty. Since the regexp engine does not support numbered repetition (something like {8} or {0,8}) the regexp grew rather long:
With the addition of the last hex digit ([0-9A-Z]) the New Name field turned from access.idl0 to <Regular expression error: Unmatched [].>
Did the regexp grow too long or is there some other error in the regexp machine?
If the expression was too long, please indicate clearly, or limit the length of textbox control.
I replaced that last [0-9A-Z] with .$, which fitted my bill.
I had a couple of files with extensions resembling a GUID, something like
Code: Select all
access.idl.29D3591E_F1C6_40AF_BCC6_7FC8BBE50B30
Code: Select all
\.[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]_[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]_[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]_[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]_[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]
Did the regexp grow too long or is there some other error in the regexp machine?
If the expression was too long, please indicate clearly, or limit the length of textbox control.
I replaced that last [0-9A-Z] with .$, which fitted my bill.