I made a simple PHP script for testing. The script is as follows:
PHP Code:
<?PHP
$content = "[loop:sections]test test[endloop:sections]";
$content = preg_replace('#\[loop:(\w+)\](.*?)\[endloop:\1\]#i', '"\1, \2"', $content);
echo $content;
?>
This script outputs (as it should) this:Now if I have modify the input so the script looks like this:
PHP Code:
<?PHP
$content = "[loop:sections]test \n test[endloop:sections]";
$content = preg_replace('#\[loop:(\w+)\](.*?)\[endloop:\1\]#i', '"\1, \2"', $content);
echo $content;
?>
the script now outputs this:
[loop:sections]test test[endloop:sections]
. Notice the newline...
How would I make it so that what's in between [loop:whatever] and [endloop:whatever], be found, even if there is newlines in there?
Thanks in advance
Bookmarks