find string, delete whole line ans replace with string only

General questions about using TextPad

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

Post Reply
jbrady33
Posts: 6
Joined: Mon Apr 03, 2006 3:46 pm

find string, delete whole line ans replace with string only

Post by jbrady33 »

Hello:

what I am trying to do:
find: ^.*(string in middle of line)?$
replace (string in middle of line


real stuff - find string "SMTP:xxxxxxx@vbelcas.mail.onmicrosoft.com" and delete everyting else on line
find:
^.*($smtp:[a-z1-9]{7}@vbelcas.mail.onmicrosoft.com)?$
that works so far

the replace I can't get right
tried:
$1
/1
\g1
$&

what am I doing wrong?

Thank in advance!
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

And if it doesn't occur on a line do you want the result to be an empty line?

Try
Find what: .*(smtp:[a-z1-9]{7}@vbelcas\.mail\.onmicrosoft\.com).*\n|.+\n
Replace with: $1\n
jbrady33
Posts: 6
Joined: Mon Apr 03, 2006 3:46 pm

Post by jbrady33 »

And I'm an idiot - had the wrong slash

should be \1
Post Reply