3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string = '[gallery columns="1" ids="137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161"]'; $pattern = '/\[(.*?)\]/i'; $replacement = '${1}1,$3'; echo preg_replace($pattern, $replacement, $string);
Output for 4.3.0 - 7.1.0
gallery columns="1" ids="137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161"1,