0 Replies Latest reply on Nov 27, 2009 6:15 AM by dgwillia1982

    Regular expression / pattern matching


      I want to match the url within this string and assign the url to a variable.


      As an example, I get access to a string like this...


      Bell's Blended Whisky is back in BC http://tinyurl.com/yck37xh it is really really tasty whiskey. You should try it.


      I need to match the Url within the above string (starting from http) and assign it as a variable.


      With regards to the pattern matching, I can easily pull out the http part of the substring (as this does not change), but I need to build upon this to pull back the rest of the URL. My code so far is below, can anyone help?


      private function onResult (e:ResultEvent):void   
                      resultArrayCollection = e.result.feed.entry as ArrayCollection;
                      for(var count:int = 0; count < resultArrayCollection.length; count++)
                          titleString = resultArrayCollection[count].title;
                          trace( titleString.match( /http/ ) );


      I firstly need help with the regular expression, then I imagine it should be a simple job to add the result of the regular expression back into the array as it's own item within the array.