fork download
  1. <?php
  2.  
  3. $text = "!@#$%^text!@#$%^";
  4. $text = preg_replace('~^[^\w]+~', "", $text);
  5. echo $text . PHP_EOL;
  6. $text = "!@#$%^text!@#$%^";
  7. $text = preg_replace('~^\W+~', "", $text);
  8. echo $text . PHP_EOL;
  9. $text = "!@#$%^0987641text!@#$%^";
  10. $text = preg_replace('~^[\W\d]+~', "", $text);
  11. echo $text . PHP_EOL;
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
text!@#$%^
text!@#$%^
text!@#$%^