fork(2) download
  1. <?php
  2.  
  3. $s = '<sup>1, 2, 3- 124</sup>';
  4. echo preg_replace_callback('~<sup>[^<]*</sup>~', function ($m) {
  5. return preg_replace('~\d+~', '{{{$0}}}', $m[0]);
  6. }, $s);
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
<sup>{{{1}}}, {{{2}}}, {{{3}}}- {{{124}}}</sup>