[ create a new paste ] login | about

Link: http://codepad.org/rpWf0JDy    [ raw code | output | fork ]

PHP, pasted on Jun 3:
1
2
3
4
5
6
<?php

$regex = "#{([^}]*)}(.*?)\{/\\1}#";
$str = '{foo}bar{/foo}';

echo preg_replace($regex, '$2', $str);


Output:
1
bar


Create a new paste based on this one


Comments: