a couple quick things.. I'm by no means an expert at regex... but...

the first backslash is unnecessary isn't it? & is not a meta
character, so the \ after the first / isn't needed. also, don't you
want to remove ALL characters between the < and > ? so I'd change the
inner [a-zA-Z0-9]* to   .*?  (the question mark makes it a lazy
quantifier instead of an agressive quantifier)

And one last thing, is you may need the multi-line flag also (if the
XML has line breaks... so I'd give this a shot... haven't tried it
myself though....

 /&lt;.*?&gt;/gim

good luck
PW

--- In [email protected], "e_baggg" <[EMAIL PROTECTED]> wrote:
>
> I am trying to create a regular expression that essentially parses out
> all the html of a text string. (i.e. - Remove all text between "&lt;"
> and "&gt;"). I am not the seasoned regex pro, but my attempts have
> failed based on research within the livedocs:
> 
> var pattern : RegExp = /\&lt;[a-zA-Z0-9]*&gt;/gi
> 
> Does anyone see what is wrong?
> 
> var stringToEdit : String = "&lt;!DOCTYPE html PUBLIC '-//W3C//DTD
> HTML 4.01 Transitional//EN'&gt;&lt;html&gt;&lt;head&gt;text I should
> see&lt;/head&gt;&lt;/html&gt;";
> 
> var pattern : RegExp = /\&lt;[a-zA-Z0-9]*&gt;/gi
> var newStr : String = stringToEdit.replace(pattern, "");
> trace(newStr);
> 
> //Desired Output:
> text I should see
> 
> //Actual output :-( 
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN"><html><head>text I should see</head></html>
>


Reply via email to