run code in 150+ php & hhvm versions
Bugs & Features
<?php $youtube_videos_count = 1; $string = 'http://youtu.be/O7Lm3BMG8ow The G20 meeting in Washington over the weekend ended with a tacit endorsement of the recent Japanese monetary policy that has caused the yen to lose 11% over the past 3 months, and has the Nikkei 30% higher since the beginning of the year. The South Koreans were complainants following pressures on its own vital export sector but was only able to get a commitment from the G20 to be mindful of unintended negative side effects stemming from extended periods of monetary easing. Finance Minister Aso told us that the other members of the G20 had agreed that the bond buying plan put forward by the Bank of Japan was inde'; $replacement = '<span class="video"><a id="youTubeVideo' . ++$youtube_videos_count . '" href="http://www.youtube.com/watch?v=$2" target="_blank">View Our Video Blog Entry For This Post</a></span>'; echo preg_replace('((http://)?(www.)?(youtube.com|youtu.be)(/v/|/watch\?v=|/)([a-zA-Z0-9_-]*)(.*))', $replacement, $string);
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0RC3
<span class="video"><a id="youTubeVideo2" href="http://www.youtube.com/watch?v=" target="_blank">View Our Video Blog Entry For This Post</a></span>