fork download
  1. <?php
  2.  
  3. $re = '/\b([WL])(2[5-9]|3[0-9]|4[0-4])\b/';
  4. $str = "W28\nL36\nW29-L32";
  5. $result = preg_replace($re, "$2$1", $str);
  6. echo $result;
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
28W
36L
29W-32L