fork download
  1. <?php
  2.  
  3. $html = "The quick brown fox jumps over the lazy dog";
  4. $replace = preg_replace('/\A(.*?)(brown fox)(.*?)\z/sim', '$1<span STYLE="font-size: x-large; color: #ffffff">$2</span>$3', $html);
  5. echo $replace;
  6. // The quick <span STYLE="font-size: x-large; color: #ffffff">brown fox</span> jumps over the lazy dog
  7.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
	The quick <span STYLE="font-size: x-large; color: #ffffff">brown fox</span> jumps over the lazy dog