Go ahead

A swapping-ground for Regular Expression syntax

RegEx woes...

Postby mvisconte » Fri Aug 12, 2005 3:43 am

Hi,

I have merged a bunch of files from the IE cache, and as some share names, and as they ALL have "[1]" in their names, i.e.,

DP0805[1].gif

I thought I was being smart by doing a manual bulk convert "[1]" to
"[" manually entered date "]", i.e.,

DP0805[811].gif
DP0805[812].gif

It worked fine, but then I wanted a better method of keeping versions straight so I decided to use the date suffix. Now, I can't get rid of the
"[" manually entered date "]"
to use the Modified Date.

Argh.

I have tried this pattern:

\[[0-9]+\]

Thinking that this should match
"[" (any numbers) "]" replacing it w/ "blank"

But NOTHING happens. On a whim, I substituted random letters in the "replace with" blank, and the result is ALL of the file name is replaced by the letters, i.e.

nnn.gif
nnn.gif

Why is my RegEx not working (or is this an issue w/ the RegEx expression - I can't imagine that)?

I have tried peice-mealing it, i.e., trying to just match the first (left) bracket, but all I get are results similar to the nnn.gif case (no changes if nothing in the Replace With, FULL file name replacement w/ whatever is typed in Replace With).

I tried it w/
"\["
"["
etc.

Thanks,

Marc
mvisconte
 
Posts: 2
Joined: Fri Aug 12, 2005 3:24 am

Effeh...

Postby mvisconte » Fri Aug 12, 2005 4:08 am

Ok, I don't know if there is an EASIER way, but I DID _find_ a way...

I forced a pattern replacement.

Repalce:
(.+)(\[[0-9]+\])(\..*)

with
\1\3

Whew.

It works, and now I can just append the modify date.

Thanks for an awesome tool.
mvisconte
 
Posts: 2
Joined: Fri Aug 12, 2005 3:24 am


Return to Regular Expressions