fork download
  1. <?php
  2.  
  3. $re = "/{#\w+='([^']*)'\s*,\s*\w+='([^']*)'}/";
  4. $str = "this photos {#img='3512.jpg', alt='Title'} and {#img='3513.jpg', alt='Title2'} any image code here related to image must be replaced.";
  5. $subst = "<img src='https://i...content-available-to-author-only...n.com/images/\$1' alt='\$2'/>";
  6. echo preg_replace($re, $subst, $str);
Success #stdin #stdout 0s 82944KB
stdin
Standard input is empty
stdout
this photos <img src='https://i...content-available-to-author-only...n.com/images/3512.jpg' alt='Title'/> and <img src='https://i...content-available-to-author-only...n.com/images/3513.jpg' alt='Title2'/> any image code here related to image must be replaced.