0

对于一个项目,我正在尝试将 htmlText 导入到 flash 中,然后删除 flash 不会处理的任何项目。例如,我要导入的 html 包含自定义的“[caption][/caption]”代码。我本质上想删除这些标识符和它们之间的任何文本,以便 Flash 不会在文本字段中显示它们。有人对我有好的建议/例子吗?我一直在试图弄清楚如何使用正则表达式来做到这一点,但未能找到一个好的指南,因此失败了。

我试图过滤的文本示例:

<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. 

我希望能够检测识别文本并删除它们之间的任何内容。我很感激任何人都可以给我的任何建议。

4

1 回答 1

1

您也许可以在没有正则表达式的情况下使用indexOflastIndexOf实现这一点。

你也应该看看String.replace

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

和 as3 正则表达式教程:

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

最后是纯正则表达式的教程:

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

于 2011-12-19T02:50:03.350 回答