Find & replace trouble

General questions about using TextPad

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

Post Reply
insolitude
Posts: 8
Joined: Tue Apr 04, 2006 12:33 am

Find & replace trouble

Post by insolitude »

Hi all, here's one I can't figure out:

FIND: (^(PG|SG|SF|PF|C))([[:upper:]][.[:lower:]])
REPLACE: \1\t\2

I'm expecting it to find lines that start with:

PGJer
SGL.P
CPeK
CK.j

etc

And the replace should result in:

PG Jer
SG L.P
C PeK
C K.j

But instead I'm getting:

PG PGr
SG SGP
C CeK
C C.j

As you can see, it's replacing with /1/t/1. Any ideas how I can clean this up? Thanks in advance!
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You've added unnecessary parentheses to your regex and then forgotten to count them. Try
Find what: ^(PG|SG|SF|PF|C)([[:upper:]][.[:lower:]])
Replace with: \1\t\2
Post Reply