Use Question Mark as wildcard character in Standard Rename?

Simple or Advanced Rename dialog, I can't type or paste a question mark as a wildcard character. If I read the "Pattern Matching Syntax" appendix of the help files correctly, it should be allowed.

I wanted to change files with names like:


Since the last 2 digits were always either 01 or 02, I used:
Old name: 0.png
New name: _0.png

which worked.

I wanted to use:
Old Name: *.png
New Name: ??_??.png

I don't know if it would have worked the way I wanted, but DOpus never gave me the chance to try because I couldn't enter the question marks in the New Name field.

Windows 7 x64
DOpus x64 version


When using wildcards outside of renaming you can use ? to match any single character.

You can't use ? when renaming, though. It is not supported as a find/replace pattern for wildcards. Only * is, to keep things simple.

Even if ? was supported when renaming, if you're matching *.png and replacing it with ??_??.png: You've got one * pattern in the old name and four ? patterns in the new name; the patterns being found don't correspond to the patterns being replaced.

If it was supported the syntax would probably be like this:

Old name: ????.png
New name ??_??.png
Type: standard rename (i.e. wildcards)

Since the wildcard syntax doesn't provide a way to specify which matched pattern is to be inserted in the new name, allowing ? probably wouldn't be a good idea. Wildcards are only suited to very simple find and replace patterns.

You can do what you were trying to do using regular expressions:

Old name: b(..).png[/b]
New name: \1_\2.png
Type: regular expressions

Thanks, leo. I appreciate you taking the time to post the "why not" of the ? character, as well as a Regular Expressions solution.


At the risk of going off-topic a bit, I have regexp logic question.

I have a similar directory to the one I outlined above, but it contains some oddball files. They all start with 2 digits, but then there is sometimes a string of letters before the last 2 digits in the stem of the file name. I want DOpus to ignore the files with letters in the file names. Like so:


In that list, I only want 0201.png and 1801.png to be renamed, and I want them renamed to 02_01.png and 18_01.png. The regexp that worked was:

Old Name: ([^a-z]+)(..).png
New Name: \1_\2.png

So is the regexp evaluation logic essentially, "Find as many non-letter characters as you can before the last 2 characters of the stem"? Is there a better way (or even just a different way) to approach this problem? I'm trying to understand the logic so that in the future I don't have to spend as much time trying (and mostly failing) to rename a large group of files.


Yes, that's right.

You could also use:

Old Name: ([0-9]+)([0-9][0-9]).png
New Name: \1_\2.png

That would ensure only digits are matched and insert an underscore before the 2nd last digit in the name. It'll work with one or more digits before where the underscore is to be inserted.

If you want it to only match four-digit filenames then you could use this:

Old Name: ([0-9][0-9])([0-9][0-9]).png
New Name: \1_\2.png

Thanks, leo! It's always good to get a different perspective. Your approach seems to attack the problem from the "look for this" angle whereas mine leaned towards "ignore that". I think I like yours better...


I really respect the RegEx wizards out there ... I mean, it's one of the coolest most powerful things around, and I can BARELY use it ... pretty much the extent of the first example above is as far as I can go without help (even RegEx Buddy and similar tools don't help me).

So bravo for those that have tamed it's power!