fork(4) download
  1. <?php
  2.  
  3. function convertBoldText($line){
  4. return preg_replace('/\*{2}(?!\s)((?:(?!\*{2}).)*)(?<!\s)\*{2}/s', "'''$1'''", $line);
  5. }
  6.  
  7. echo convertBoldText("** these first asterisks should NOT be replaced **but these ones SHOULD**");
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
** these first asterisks should NOT be replaced '''but these ones SHOULD'''