Chnaging a section based on the line above?

General questions about using TextPad

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

Post Reply
JBNY
Posts: 7
Joined: Wed Mar 25, 2009 7:24 pm

Chnaging a section based on the line above?

Post by JBNY »

Trying to figure this one out, I'm cleaning up html docs and I am trying to get some formatting done. I need to do the following replacement on about 80-90 sections.

Find

<DIV align=right><B>a bunch of text here</B></DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;More text here as well</DIV>

replace

<DIV align=right><B>a bunch of text here</B></DIV>
<DIV height="30">More text here as well</DIV>

Basically I just need to change

<DIV>&nbsp;&nbsp;&nbsp;&nbsp;

To

<DIV height="30">

When the line above it starts with <DIV align=right><B>

Any thoughts?

Thanks
-Joe
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Find: (<DIV align=right><B>.*)\n(<DIV>&nbsp;&nbsp;&nbsp;&nbsp;)
Replace with: \1\n<DIV height="30">

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------

Edited note:
ben_josephs posted solution at the same time. As usual, his is better. :shock:
Last edited by Bob Hansen on Tue Apr 14, 2009 3:38 pm, edited 3 times in total.
Hope this was helpful.............good luck,
Bob
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: (<DIV align=right><B>.*)\n<DIV>&nbsp;&nbsp;&nbsp;&nbsp;
Replace with: \1\n<DIV height="30">

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

:-) Almost identical! Mine is a tiny bit faster.
JBNY
Posts: 7
Joined: Wed Mar 25, 2009 7:24 pm

Post by JBNY »

Thank you, that worked perfect!
-Joe
Post Reply