【发布时间】:2013-02-06 09:42:31
【问题描述】:
AS3 |多维空气 3.5 | Flash CS6
我已从在线源中提取的 html 放入一个字符串中,我将根据我提取的信息将其逐个拆开以构建一个 XML 文件。我需要搜索整个字符串以删除“info”之后的字符,直到字符“&”。整个字符串中有多个这样的实例,所以我认为最好使用 RegExp。欢迎提出其他建议。
//code from the website put into a full string
var fullString = new String(urlLoader.data);
//search string to find <info> and remove characters AFTER it up until the character '&'
var stringPlusFive:RegExp = /<info>1A2E589EIM&/g;
//should only remove '1A2E589EIM' leaving '<info>&'
fullString = fullString.replace(stringPlusFive,"");
我无法弄清楚的问题是“1A2E589EIM”不一致。它们是随机数字和字符,可能还有长度,所以我不能真正使用上面写的内容。它总是会导致一个“&”。
提前感谢您的帮助。
【问题讨论】:
标签: regex actionscript-3 flash air flash-cs5