Replacement expression truncated?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
I Steal Toast
Posts: 14
Joined: Wed Feb 02, 2005 3:05 am
Location: Why do you want to know? <_< >_>
Contact:

Replacement expression truncated?

Post by I Steal Toast »

I have a document containing several file names, like this:

rename "01 - BooHooWoo - .hack,,GAME MUSIC Perfect Collection CD3 - %" 01T_dtpOp.wav
rename "02 - BooHooWoo - .hack,,GAME MUSIC Perfect Collection CD3 - %" 02T_apriSlct.wav
rename "03 - BooHooWoo - .hack,,GAME MUSIC Perfect Collection CD3 - %" 03T_menuFix.w

What I'm trying to do is replace the % with the short name after the quotes, so the first one would be replaced with 01T_dtpOp.wav, the second with 02T_apriSlct.wav and so on. I've used this POSIX regular expression:
Find: [[:print:]]%" ([[:print:]])
Replace: \1" \1
[edit: There should be a space before the first '\1', but it doesn't show up on the board.]
The replacement works but the first \1 (replacing the percent sign) is truncated to one character! (Ex: rename "01 - BooHooWoo - .hack,,GAME MUSIC Perfect Collection CD3 - 0" 01T_dtpOp.wav) Why is this happening?
I stole your toast.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

The second [[:print:]] just captures one letter, you must use the + quantifier.
Find [[:print:]]%"_([[:print:]]+)
Replace _\1"_\1
Where _=space
I have used POSIX regular expression syntax, which can be selected from the Editor page of the Preferences dialog box. HTH
Then I open up and see
the person fumbling here is me
a different way to be
Post Reply