Get Attachment ID from media_sideload_image()

Problem

In this scenario,

$image = media_sideload_image($downloadable_path, $post_id);

The $image variable now returns the full HTML, like this (with single quotes for some reason)

<img src="http://www.somesite.com/wp-content/uploads/2012/11/image8.jpg" alt="" />

Which isn’t so bad, unless we want to get Just the image URL, or maybe the Thumbnail URL, or just the attachment ID.
Here is how to do it.
More

Filter an HTML Select Dropdown in Regex

I have had a repeated need for this.

Baiscally what it does it turns:


Awesome Number
Top Number

into

Awesome Number is 99
Top Number is 100

Sometimes useful, decided to save & share :nerd:

Search:
/([^<]+)/
Replace:
$2 is $1