I am trying to retrieve part of the src from different iframes from an HTML input.
So far, I've tried different methods but none of them works for all iframes. What I've tried so far:
<iframe(.*?)><\/iframe>
<iframe src="(.+?)".+</iframe>
<iframe.+?src=[\"'](.+?)[\"'].*?>
And here is a sample of iframe tags that I have:
<iframe src="http://www.youtube.com/embed/NM51qOpwcIM?modestbranding=1;rel=0;showinfo=0;autoplay=0;autohide=1;yt:stretch=16:9;wmode=transparent;?wmode=transparent" allowfullscreen="" style="width: 640px; height: 361.057px;" frameborder="0"></iframe>
<iframe src="https://www.youtube.com/embed/VASywEuqFd8?feature=oembed" allowfullscreen="" width="660" height="371" frameborder="0"></iframe>
Ideally, I would like to retrieve the src from the beginning and just before the first question mark (?) as such:
http://www.youtube.com/embed/NM51qOpwcIM