Renaming with a RegEx

I need to rename some files. My publishing system doesn't allow underscores. But, some software I use creates underscores when it splits PDFs into multiple files. I need to get rid of the underscores and simply replace them with the letter "p" for "page." But, the pages might have leading zeroes, and, I want to accommodate them, basically, by deleting them.

I'm trying this. These are my files.


ren ::_[0]{1,4} ::p

And, that doesn't work. I get this.

[F:\workflows\grafix\TM_PDF]ren ::_[0]{1,4} ::p
TCC: (Sys) There are no more files.
TCC: (Sys) The system cannot find the file specified.
0 files renamed

It does work when I simply have the underscore alone replaced with the "p." But, not with the regex for one or more zeroes.

May 29, 2008
Groton, CT
You probably have to quote the comma in some way. It looks like TCC is seeing ::_[0-]{1 as a file name and 4} as another file name, separated by the comma.
Similar threads
Thread starter Title Forum Replies Date
JohnQSmith Regex renaming Support 2
P Renaming files with regex. Support 6
J Extended directory search - cure by renaming tcmd.ini Support 10
nickles Renaming bug? Support 9
S GPF after successfully renaming directories on an ftp server Support 2
M More file-renaming problems involving commas... Support 0
M Another problem with renaming files... Support 3
gunkelkarl renaming files Support 14
F %@regex["^-","-a"] returns 0, "^-" =~ "-a" is false (no match) Support 4
vefatica TPIPE: unbalanced escaped quotes in a regex? Support 5
rps Regex problem: \xnn not recognized as a hex character Support 0
old coot Regex problem: \xnn not recognized as a hex character Support 12
R Regex using ^ Support 2
T Regex engine doesn't recognize native DOS line endings Support 2
P Simple RegEx copy Support 9
samintz WAD Regex Analyzer Support 1
D How to? Use typed envars using regex. Support 3
R How to? use @everything perl regex Support 2
C v18 regex help please Support 1
C Font of RegEx Analyzer Support 0
D Regex problem Support 17
mikea How to? Regex match when there shouldn't be (?) Support 18
JohnQSmith Fixed Copying with regex (several issues) Support 7
D Help needed to get a regex to work Support 3
thedave WAD Regex match on \h Support 5
Ville Regex & conditionals Support 9
samintz Regex Rename Support 2
vefatica @REGEX: behavior vs. documentation Support 2
vefatica @REGEX revisited Support 4
vefatica @REGEX question Support 6
vefatica Regex question Support 5
B Regex and Replace Support 6
Stefano Piccardi detecting BOM, FFIND multibyte regex Support 18
dcantor FFIND syntax -- is /E"regex" /X supported? Support 2
B "Fun" with DO and Regex Support 12
P Need to use a regex in a "for" loop. Support 54

Similar threads