Page 1 of 1

Line Splitting

Posted: Thu Mar 04, 2004 3:16 pm
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

Posted: Thu Mar 04, 2004 4:26 pm
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.

Posted: Thu Mar 04, 2004 5:29 pm
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.