EmEditor (text editor) Forum Index
   Regular Expressions
     How to clean unclosed HTML TAG ?
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
Stefan
Posted on: 11/13/2012 9:52 pm
Home away from home
Joined: 7/14/2008
From: Germany, EU
Posts: 261
Re: How to clean unclosed HTML TAG ?
.

Hi and welcome.

1.)
Do "<span" and "</span>" always be on the same line?

Or could it be that they are on different lines like

1. <p><span style="font-weight:bold;">
CCNA Portable Command Guide</span></p>


Your example doesn't provide this detail.

- - -

2.)
Is it always the first occurrence of "</span>" in a line that can be remove?

Then the rule would be easier:
if there is found a closing tag without an opening tag before, then it can be removed.

Proof Of Concept:

openTag    = "<span";
closingTag = "</span";

yLine = document.selection.GetActivePointY( eePosLogical );
str   = document.GetLine( yLine );
openTagPos    = str.indexOf(openTag);
closingTagPos = str.indexOf(closingTag);

if(closingTagPos > -1){
	if(openTagPos == -1 || (closingTagPos < openTagPos)){
		alert("delete");
	}else{
		alert("all ok");
	}
}else{
	alert("not found " + closingTag);
}
Flat Previous Topic | Next Topic


Subject Poster Date
   How to clean unclosed HTML TAG ? liloli 11/13/2012 4:49 pm
   » Re: How to clean unclosed HTML TAG ? Stefan 11/13/2012 9:52 pm
       Re: How to clean unclosed HTML TAG ? liloli 11/14/2012 3:48 pm
         Re: How to clean unclosed HTML TAG ? Stefan 11/14/2012 9:29 pm
           Re: How to clean unclosed HTML TAG ? liloli 11/17/2012 3:34 pm
             Re: How to clean unclosed HTML TAG ? Stefan 11/18/2012 2:32 am
               Re: How to clean unclosed HTML TAG ? liloli 11/18/2012 4:06 pm
                 Re: How to clean unclosed HTML TAG ? Yutaka 11/18/2012 4:41 pm
                   Re: How to clean unclosed HTML TAG ? liloli 11/18/2012 6:20 pm

Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文