1 Reply Latest reply on May 9, 2008 10:43 PM by Gregory Lafrance

    RegEx problem

    bh5k
      I am trying to do a regular expression in Flex 3 actionscript:

      private function parseImageUrl(fromHtml:XMLList):String
      {

      var pattern:RegExp = /"image\/jpeg" src="(.+?)" /;
      var results:Array = pattern.exec(fromHtml);
      var imageURL:String = results[1]; // backreference 1 from pattern

      return imageURL;
      }

      This is the string that I am passing in:

      <content type="image/jpeg" src=" http://lh6.ggpht.com/bryan/SBkgbpMm7dI/AAAAAAAAACo/PbmSgITG5iU/P4290026.JPG" xmlns=" http://www.w3.org/2005/Atom" xmlns:openSearch=" http://a9.com/-/spec/opensearchrss/1.0/" xmlns:exif=" http://schemas.google.com/photos/exif/2007" xmlns:geo=" http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml=" http://www.opengis.net/gml" xmlns:georss=" http://www.georss.org/georss" xmlns:photo=" http://www.pheed.com/pheed/" xmlns:media=" http://search.yahoo.com/mrss/" xmlns:batch=" http://schemas.google.com/gdata/batch" xmlns:gphoto=" http://schemas.google.com/photos/2007"/>

      I have tested the regular expression here http://www.regular-expressions.info/javascriptexample.html and it says it is valid. So what do I seem to be doing wrong?

      TIA,

      Bryan