Ich möchte jedes Zeichen nachBBCode übereinstimmen, aber der unten BBCode stimmt nicht überein Texte, die folgen, wenn ich eine Bruchlinie mache.PHP Match alle Zeichen in der neuen Zeile mit Regex
$string="[nextpage] This is how i decided to make a living with my laptop.
This doesn't prevent me from doing some chores,
I get many people who visits me on a daily basis.
[nextpage] This is the second method which i think should be considered before taking any steps.
That way does not stop your from excelling. I rest my case.";
$pattern="/\[nextpage\]([^\r\n]*)(\n|\r\n?|$)/is";
preg_match_all($pattern,$string,$matches);
$totalpages=count($matches[0]);
$string = preg_replace_callback("$pattern", function ($submatch) use($totalpages) {
$textonthispage=$submatch[1];
return "<li> $textonthispage";
}, $string);
echo $string;
Dies gibt nur die Texte in der ersten Zeile zurück.
<li> This is how i decided to make a living with my laptop.
<li> This is the second method which i think should be considered before taking any steps.
Erwartetes Ergebnis;
<li> This is how i decided to make a living with my laptop.
This doesn't prevent me from doing some chores,
I get many people who visits me on a daily basis.
<li> This is the second method which i think should be considered before taking any steps.
That way does not stop your from excelling. I rest my case.