AS3 | Adove Air 3.5 | Flash CS6
I have html pulled from a source online put into a String that I’m taking apart piece by piece to build an XML file based off of the information I pulled. I need to search the whole String to remove characters following “info” up until the character “&”. There are multiple instances of this throughout the string, so I thought it would be best to use a RegExp. Other suggestions are welcomed.
//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,"");
The problem I’m having trouble figuring out is the “1A2E589EIM” is not consistent. They are random numbers and characters, and possibly length, so I can’t really use what I have written above. It will always lead up to a “&”.
Thanks in advance for any help.
I think the regexp would be more like
now, if you are going to parse your string to XML, you could wait until you have your XML structure and just remove the info string from ‘info’ nodes
I’m not sure about the affectation to *[0] but it should be something like that. Hope this helps.