title: swift rss feed parse extract href from content encoded
body: <p>I have a regular rss feed that looks like this </p>
  
  <pre><code>&lt;content:encoded&gt;&lt;![CDATA[&lt;div style="width: 1280px; " class="wp-video"&gt;&lt;video class="wp-video-shortcode" id="video-54267-2" width="1280" height="720" preload="metadata" controls="controls"&gt;&lt;source type="video/mp4" src="http://www.thestreetlede.com/wp-content/uploads/2016/05/bJFWyEWkx5Ri.mp4?_=2" /&gt;&lt;a href="http://www.thestreetlede.com/wp-content/uploads/2016/05/bJFWyEWkx5Ri.mp4"&gt;http://www.thestreetlede.com/wp-content/uploads/2016/05/bJFWyEWkx5Ri.mp4&lt;/a&gt;&lt;/video&gt;&lt;/div&gt;
  ]]&gt;&lt;/content:encoded&gt;
  </code></pre>
  
  <p>my goal is to extract the link  "http.." from this <code>&lt;a href="http://www.thestreetlede.com/wp-content/uploads/2016/05/bJFWyEWkx5Ri.mp4"&gt;</code>
  using a regex in swift however I'm very new to this concept and my code won't extract the video however i got a regex to work for images here is my code
  for images:
  <code>let regex = "['\"][^'|^\"]*?(?:png|jpg|jpeg|gif)[^'|^\"]*?['\"]"
  </code></p>
  
  <p>the part i need assistance with (videos) 
  <code>:let regex = "['\"][^'|^\"]*?(?:mp4)[^'|^\"]*?['\"]"</code>
  this returns:[] everytime I'm not sure how to fix the regex
  if i figure out my mistake i will update and any help is appreciated</p>
  
  <p>Update</p>
  
  <p>I created this function but it still isn't working does anyone see the problem or could point me in the right direction</p>
  
  <pre><code>func getImageURLsFromContent(content: String) -&gt; [String] {
      let regex = "&lt;a\\s+href=\"([^\"]+)\""
      var substr = content
      var result: [String] = []
      while let match = substr.rangeOfString(regex, options: [.RegularExpressionSearch, .CaseInsensitiveSearch]) {
          var matchingString = substr.substringWithRange(match)
          matchingString = matchingString.substringFromIndex(matchingString.startIndex.successor())
          matchingString = matchingString.substringToIndex(matchingString.endIndex.predecessor())
  
          if matchingString.rangeOfString("http:", options: .CaseInsensitiveSearch) != nil || matchingString.rangeOfString("https://", options: .CaseInsensitiveSearch) != nil {
              result.append(matchingString)
          }
          substr = substr.substringFromIndex(match.startIndex.advancedBy(matchingString.characters.count))
      }
      print(result)
      return result
  }
  </code></pre>