3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $body = '<blockquote class="instagram-media" data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);"> <div style="padding:8px;"> <div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:50.0% 0; text-align:center; width:100%;"> <div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURczMzPf399fX1+bm5mzY9AMAAADiSURBVDjLvZXbEsMgCES5/P8/t9FuRVCRmU73JWlzosgSIIZURCjo/ad+EQJJB4Hv8BFt+IDpQoCx1wjOSBFhh2XssxEIYn3ulI/6MNReE07UIWJEv8UEOWDS88LY97kqyTliJKKtuYBbruAyVh5wOHiXmpi5we58Ek028czwyuQdLKPG1Bkb4NnM+VeAnfHqn1k4+GPT6uGQcvu2h2OVuIf/gWUFyy8OWEpdyZSa3aVCqpVoVvzZZ2VTnn2wU8qzVjDDetO90GSy9mVLqtgYSy231MxrY6I2gGqjrTY0L8fxCxfCBbhWrsYYAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px; position:relative; top:-22px; width:44px;"></div> </div> <a href="https://www.instagram.com/p/BWOJZQxleIF/" style=" color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none;" target="_blank">Ryo Miyaichi Official 宮市亮さん(@ryo381)がシェアした投稿</a> - <time style=" font-family:Arial,sans-serif; font-size:14px; line-height:17px;" datetime="2017-07-06T21:58:23+00:00">2017 7月 6 2:58午後 PDT</time> <br /> </div> </blockquote> <script async="" defer="" src="//platform.instagram.com/en_US/embeds.js"></script>'; $body = preg_replace_callback('!(https://twitter.com/[^/]+?/status/\d+)!s', function ($matches) { return '[[embed-twitter]](' . trim($matches[1]) . ')'; }, $body); $body = preg_replace_callback('!(<blockquote class="twitter-tweet" align="center">.*?\(\[\[embed-twitter\]\]\((https://twitter.com/[^/]+?/status/\d+)\)\)</blockquote>)!s', function ($matches) { return '[[embed-twitter]](' . trim($matches[2]) . ')'; }, $body); $body = preg_replace_callback('!(<blockquote class="twitter-.*?(\[\[embed-twitter\]\]\(https://twitter.com/[^/]+?/status/\d+\)).+?</blockquote>.+?twitter.com.+?</script>)!s', function ($matches) { return trim($matches[2]); }, $body); // InstagramのURLをembedに変換 $body = preg_replace_callback('!(https://www.instagram.com/p/[^/]+?/[\?a-zA-Z0-9_\-=]*)!s', function ($matches) { return '[[embed-instagram]](' . trim($matches[1]) . ')'; }, $body); $body = preg_replace_callback('!(<blockquote class="instagram-.*?(\[\[embed-instagram\]\]\(https://www.instagram.com/p/[^/]+?/[\?a-zA-Z0-9_\-=]*\)).+?</blockquote>.+?instagram.com.+?</script>)!s', function ($matches) { return trim($matches[2]); }, $body); echo $body; ?>
based on Vhacv
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
[[embed-instagram]](https://www.instagram.com/p/BWOJZQxleIF/)