Page 1 of 1

Find & replace trouble

Posted: Mon Nov 02, 2015 9:42 am
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!

Posted: Mon Nov 02, 2015 2:07 pm
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