Remove text within certain identifiers from html string in AS3

For a project, I'm trying import htmlText into flash, and then remove any items flash will not process. For example, the html I want to import contains custom "[caption][/caption]" code. I essentially want to remove these identifiers and any text from in between them so that flash will not display them in a text field. Does anyone have a good suggestion/example for me? I have been trying to figure out how to use regular expressions to do this, but have been unsuccessful in finding a good guide for it and so have failed.

And example of text I'm trying to filter:

<em>Pushmo</em> is a game filled with questions. How do I solve this puzzle? Is that a 8-bit Mario's face? Why is this old, obese blob making tons of death traps that easily ensnare and encase unsuspecting children?

[caption id="attachment_37414" align="alignleft" width="400" caption="The fat, red sumo goes into the most dangous place imaginable."]<a href="/2011/12/pushmo-review/pushmo-3ds-title-screen/" rel="attachment wp-att-37414"><img class="size-medium wp-image-37414" title="Pushmo-title" src="/2011/12/pushmo-3ds-title-screen-400x203.jpg" alt="Pushmo Title Screen" width="400" height="203" /></a>[/caption]

<em>Pushmo</em> is a downloadable puzzle game in the 3DS eShop. In <em>Pushmo</em> you take on the role of Mallo, an amorphic red sumo wrestler with the mind of an Einstienian savant. 

I'm looking to be able to detect identifying text and remove anything between them. I'd appreciate any suggestions anyone can give me.

Answers


You might be able to use indexOf and lastIndexOf to achieve this without regex.

Also you should have a look at String.replace

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/String.html

and an as3 regex tutorial:

http://snipplr.com/view/6608/as3-regular-expression-basics/

finally a tutorial for pure regex:

http://www.regular-expressions.info/tutorial.html


Need Your Help

browserFIeld never release its focus in blackberry os5?

blackberry

This is may be old question but i dont get proper solution

<button> no submitting form

javascript html

I have a button that I have tied to some JS that is disabling the button and changing the text to 'Loading...' once clicked, then the APIs go to work(around 12-15 seconds). However when I click the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.