fork download
  1. <?php
  2.  
  3. $txt = "this TEST-001 is test TEST-001string TEST-001";
  4. $re1='TEST'; # Word 1
  5. $re2='-'; # Any Single Character 1
  6. $re3='\d+'; # Integer Number 1
  7. echo preg_replace("/$re1$re2$re3/", "<a href=/$0>$0</a>", $txt);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
this <a href=/TEST-001>TEST-001</a> is test <a href=/TEST-001>TEST-001</a>string <a href=/TEST-001>TEST-001</a>