Einzelnen Beitrag anzeigen

Benutzerbild von d3g
d3g

Registriert seit: 21. Jun 2002
602 Beiträge
 
#2

Re: [PHP] PCRE's und Multiline

  Alt 31. Mai 2004, 17:35
Zitat von Chakotay1308:
Funktioniert soweit ganz gut, aber obwohl ich den Modifier m gesetzt habe funktioniert es bei mehrzeiligen Texten nicht mehr.

Gibt es dafür eine plausible Erklärung?
Ja, der m-Modifier ist für was anderes gedacht.

Zitat von http://www.php.net/manual/en/pcre.pattern.modifiers.php:
When this modifier is set, the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the subject string, respectively, as well as at the very start and end. This is equivalent to Perl's /m modifier. If there are no "\n" characters in a subject string, or no occurrences of ^ or $ in a pattern, setting this modifier has no effect.
Probiers mal mit
Code:
$match[] = '#\[quote\]((.|\n)*?)\[\/quote\]#i';
[EDIT]Mir fällt nur gerade auf: Willst du nicht ohnehin vorher noch alle \n durch
ersetzen? Dann ergibt sich das Problem nämlich gar nicht.[/EDIT]
-- Crucifixion?
-- Yes.
-- Good. Out of the door, line on the left, one cross each.
  Mit Zitat antworten Zitat