Advanced Mode

In many cases simple search and replace operations are not sufficient. More complex replacements in filenames can be accomplished using regular expressions for substring matching and algorithmic replacement/insertion for changing the selected filenames. Thus the advanced mode of SDLRename offers these features: you specify a regular expression (the search expression) which is matched against the filename. If a match is found you can use the matched substrings (corresponding to the regular expression tokens) and apply them in the replacement clause.

Search The search expression is a regular expression and is used to select parts of the filenames for replacement during renaming.
Replace The replace expression contains the replacement strings for renaming.
If Condition SDLRename allows refining the renaming operation by specifying replacement conditions based on the contents of the search tokens (see section "Conditional Replacement" below)
Display Tokens Clicking this button displays the search tokens.

The replacement expression may be any character string and may contain any number of place holders for the first 9 regular expression tokens of the search expression. The place holders are identified by the character combination @n, with n being a number between 1 and 9 (a double @character in the replacement string has to be used for inserting @ characters). In addition, the replacement token may be modified by a preceding replacement modifier.

Replacement Modifiers

Modifiers have to precede the replacement token and are only valid for this particular token. Replacement substrings addressed by the @-syntax may be modified before reinserting it into the destination name by the following modifiers:

Modifier Explanation
@D decrement numeric string by one; ignore if string is non-numeric
@I increment numeric string by one; ignore if string is non-numeric
@B double numeric string; ignore if string is non-numeric
@L convert to lowercase letters
@U convert to uppercase letters
@V convert all characters which to not comply with the 8.3 Windows filename convention by underscores
@Y convert umlauts into ASCII character combinations
@Z convert to letter and digit-only string; all other characters are replaced by underscores

Conditional Replacement

In addition to the powerful regular expressions the replacement process may be controlled by a condition which is defined by a logical comparison of a particular token to a string. There are four possible conditions:

  • the regular expression token is equal to the string
  • the token is not equal to the string
  • the token contains the string
  • the token does not contain the string

Algorithmic Insertions

Apart from replacement tokens and modifiers, SDLRename allows to insert algorithmically generated substrings. These substrings are identified by matching angle brackets containing one of the following commands:
Command Explanation
<#on> Insert a decimal serial number, formatted to have a minimum of n digits (n=1..9). The file number is derived from the current position of the file in the list of files. Thus the number will change if you change the sort order.
<#rn> Insert a random number with n digits (n=1..9). Please note that the random numbers are not guaranteed to be unique - expecially when n is low it might and will occur that some of the generated numbers will be equal.
<dfmt> Insert date/time string using the format fmt. The date/time used for this insertion is acquired from the system clock when clicking the "execute" button.
<f> Insert the folder name (not the full path) of the file. This option can be especially useful for renaming file having the same name in different directories (e.g. "image1.gif").


Last Update: 2006-Nov-01