Search Tokens

Any regular expression can be split into individual tokens which have to match the text to be searched in the order the tokens occur in the search expression. A regular expression search is successful if all tokens can be matched to the target text (i.e. the filename) in a way that all matched substrings are non-overlapping and connected in the same order as the tokens accur in the regular expression.

SDLRename allows to re-use the matched substrings in the replacement expression. Each token has a number (beginning with 1) which is derived from the order of occurrence in the regular expression. The corresponding substring can be addressed by a preceding @-sign and the number of the token. In order to make it easier to know the individual tokens, SDLRename lists the tokens if you click the button "Display Tokens" (advanced mode only). The search tokens correspond to the commands of the regular expressions.

Example:

The search expression m.*\.zip$ matches all filenames beginning with the character "m" and having the file extension .zip. This search expression consists of 4 tokens:

m substring
.* any number of characters
\.zip the substring .zip
$ the end of line identifier

Please note that the end of line identifier is necessary to correctly recognize a file extension. Omitting this identifier would result in a match even if the substring .zip is in the middle of the filename (e.g. myfile.zip08, or myfile.zip.backup).


Last Update: 2006-Nov-01