Line Splitting

General questions about using TextPad

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

Post Reply
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Line Splitting

Post by trespasser »

Hi all,

I'm wondering if someone can help me with a bit of a problem, I have a text file that I need to seperate out into individual lines between the HTML tags but I cant work out how to do it, I am thinking that I will need to use a macro but not sure how to go about it, the file text looks something like below.

<H2>ASH</H2> <P class=info>3 beds; Sng garage; Please contact us for price information.<BR></P> <DIV class=infoLinks><A href="PropertySearch.aspx?HouseStyle=1869&amp;ShowHome=Y">Showhome</A> | <A href="ShowLargeFloorPlan.aspx?StyleName=ASH">View Floorplan</A> | <A href="ShowLargeStyleImage.aspx?StyleName=ASH">View Large Image</A> </DIV> <DIV class=rule></DIV><IMG class=thumb id=rptHouses__ctl1_imgHousesImage style="WIDTH: 80px; HEIGHT: 60px" alt=Fir src="/images/portfolio/fir_tn.gif" border=0> <H2>FIR</H2> <P class=info>3 beds; None garage; Please contact us for price information.<BR></P> <DIV class=infoLinks><A href="PropertySearch.aspx?HouseStyle=1955&amp;ShowHome=Y">Showhome</A> | <A href="ShowLargeFloorPlan.aspx?StyleName=Fir">View Floorplan</A> | <A href="ShowLargeStyleImage.aspx?StyleName=Fir">View Large Image</A> </DIV> <DIV class=rule></DIV><IMG class=thumb id=rptHouses__ctl2_imgHousesImage style="WIDTH: 80px; HEIGHT: 60px" alt=Lime src="/images/portfolio/lime_tn.gif" border=0>

<H2>ASH</H2> Is the beginning of the line
border=0> Is the end of the line,

I have tried to make this as clear as possible and if anyone can help I would be grateful.

Thanks Phil
User avatar
talleyrand
Posts: 625
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

A bit cheesey, but you could do a search and replace on '> ' with '>\n' and then do a S&R using '><' with '>\n<' I doesn't handle all cases but at least with the snippet provided it'd get you 90%. Oh and check the regular expressions button and it shouldn't matter but set it POSIX style regular expressions in your preferences.
I choose to fight with a sack of angry cats.
User avatar
s_reynisson
Posts: 940
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

What about inserting a newline after each </tag>?
Find </[^>]+>
Replace \0\n
Results in (max your browser window to get a better look)

Code: Select all

<H2>ASH</H2>
 <P class=info>3 beds; Sng garage; Please contact us for price information.<BR></P>
 <DIV class=infoLinks><A href="PropertySearch.aspx?HouseStyle=1869&amp;ShowHome=Y">Showhome</A>
 | <A href="ShowLargeFloorPlan.aspx?StyleName=ASH">View Floorplan</A>
 | <A href="ShowLargeStyleImage.aspx?StyleName=ASH">View Large Image</A>
 </DIV>
 <DIV class=rule></DIV>
<IMG class=thumb id=rptHouses__ctl1_imgHousesImage style="WIDTH: 80px; HEIGHT: 60px" alt=Fir src="/images/portfolio/fir_tn.gif" border=0><H2>FIR</H2>
 <P class=info>3 beds; None garage; Please contact us for price information.<BR></P>
 <DIV class=infoLinks><A href="PropertySearch.aspx?HouseStyle=1955&amp;ShowHome=Y">Showhome</A>
 | <A href="ShowLargeFloorPlan.aspx?StyleName=Fir">View Floorplan</A>
 | <A href="ShowLargeStyleImage.aspx?StyleName=Fir">View Large Image</A>
 </DIV>
 <DIV class=rule></DIV>
<IMG class=thumb id=rptHouses__ctl2_imgHousesImage style="WIDTH: 80px; HEIGHT: 60px" alt=Lime src="/images/portfolio/lime_tn.gif" border=0>
I have used POSIX regular expression syntax, which can be selected
from the Editor page of the Preferences dialog box.
Then I open up and see
the person fumbling here is me
a different way to be
Post Reply