Page 1 of 1

Chnaging a section based on the line above?

Posted: Tue Apr 14, 2009 2:26 pm
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

Posted: Tue Apr 14, 2009 3:32 pm
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:

Posted: Tue Apr 14, 2009 3:32 pm
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

Posted: Tue Apr 14, 2009 3:35 pm
by ben_josephs
:-) Almost identical! Mine is a tiny bit faster.

Posted: Tue Apr 14, 2009 3:54 pm
by JBNY
Thank you, that worked perfect!