Snippet Name: Get text between tags
Description: Gets the text between any pair of tags, matching or not.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009
|
<?PHP
$str = "
Line 1: This is a string
Line 2: <pre>This is something within a pre-formatted section
spanning 2+ lines.
The end.</pre> Should not be included.
Line 3: End of test string.";
PREG_MATCH("|<pre>(.+)</pre>|si", $str, $m);
ECHO NL2BR($m[1]);
?>
|