RE: [flexcoders] Using Flex to extract a phrase from a text file
How about: var pos:int = randomText.indexOf('.swf'); var url:String = randomText.substring(0, pos + 4); pos = url.lastIndexOf(''); url = url.substring(pos + 1); From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of João Sent: Tuesday, March 20, 2007 2:43 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Using Flex to extract a phrase from a text file I have one text file with about 100 lines of random text. Somewhere on the file, there is an URL for a SWF. The url has the .swf word in it, and it's between 's . The format of the file can change over time, and there is only one SWF file on the text file. I need to find the best algorithm to extract the URL from the text file. Any suggestions? Thanks, João Saleiro
Re: [flexcoders] Using Flex to extract a phrase from a text file
Regexp will save the world, one text document at a time. var s:String = some long \text\ goes in here and a swf url \one/two/three.swf\ went in there; var re:RegExp = new RegExp('([^]+.swf)','i'); var m:Array = s.match(re); trace(m[1]); // one/two/three.swf Cheers, Adam - Original Message - From: João To: flexcoders@yahoogroups.com Sent: Wednesday, March 21, 2007 7:43 AM Subject: [flexcoders] Using Flex to extract a phrase from a text file I have one text file with about 100 lines of random text. Somewhere on the file, there is an URL for a SWF. The url has the .swf word in it, and it's between 's . The format of the file can change over time, and there is only one SWF file on the text file. I need to find the best algorithm to extract the URL from the text file. Any suggestions? Thanks, João Saleiro