[ create a new paste ] login | about

Link: http://codepad.org/KP83SrNc    [ raw code | output | fork ]

PHP, pasted on Jun 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

$template_text = "{{some template
|example=$123.45
}}";

$existing_page_content = "
Foobar

== Example ==
{{{insertionpoint}}}

";

$existing_page_content = preg_replace( '/\{\{\{insertionpoint\}\}\}(\r?\n?)/',
                                                preg_replace( '/\}\}/m', '}�',
                                                        preg_replace( '/\{\{/m', '�{', $template_text ) ) .
                                                "{{{insertionpoint}}}",
                                                $existing_page_content );

echo $existing_page_content;


Output:
1
2
3
4
5
6
7

Foobar

== Example ==
�{some template
|example=3.45
}�{{{insertionpoint}}}


Create a new paste based on this one


Comments: