fork download
  1. <?php
  2.  
  3. $tests = [
  4. "Apelido\n\nFulano de Tal",
  5. "Apelido:\nFulano de Tal",
  6. "Apelido: Fulano de Tal"
  7. ];
  8.  
  9. foreach($tests as $test) {
  10.  
  11. if (preg_match("/(Apelido\:?)(\s+)(.*)/", $test, $matches)) {
  12.  
  13. echo $matches[3], PHP_EOL;
  14.  
  15. }
  16.  
  17. }
Success #stdin #stdout 0.01s 82944KB
stdin
Standard input is empty
stdout
Fulano de Tal
Fulano de Tal
Fulano de Tal