Ich habe einen Text und möchte einfach alles nach meinem ersten Capture entfernen. Ich habe herausgefunden, dass ich mindestens so oft wie ich Zeilenumbrüche wiederhole. "\ s". Aber ich hoffe, dass es eine flexiblere und trockenere Lösung dafür gibt.preg_replace ALLES: Text und Zeilenumbrüche
$subject = "SomeText() asaas
DFDFDFD
dsdsds
dsdsds";
$pattern = "#\).*\s*.*\s*.*\s*.*#" ;
$replacement = ")";
$newText = preg_replace($pattern, $replacement, $subject);
Utils_Echo::myEcho($subject);
Utils_Echo::myEcho($newText);
$pattern = "#\)[.\s]*#"; //I hoped something like this would work but it could not figure it out. Can you show me a way?
Alle drei Antworten in inproving meine Fähigkeiten helfen mir passen. Vielen Dank. –