Re: Ignoring HTML tags in RegExp

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Evertjan." <exjxw.hannivoort@xxxxxxxxxxxx> wrote in message
news:Xns99D6A39DB369Aeejj99@xxxxxxxxxxxxxxxxxx
Anthony Jones wrote on 27 okt 2007 in microsoft.public.scripting.jscript:

var rgx = /<[^>]*>/g
sText = sText.replace(rgx, '')

The code above will remover all < > tags leaving just tags.

... leaving just text, meseems.

Even then you might hope so!

Try:

var sText = "When <b>4 < 1</b> return true";

The assumption is that the string is html in which case the 4 < 1 would be 4
&lt; 1 .

--
Anthony Jones - MVP ASP/ASP.NET


.