
December 24th, 2002, 10:15 PM
|
|
Junior Member
|
|
Join Date: May 2002
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
How to extract data from a variable between two separators?
Hi,
Let's say I have the fallowing structure:
PHP Code:
<?php
$article = "Ok.. some text here...
(start)
first * second
third * forth
fifth * sixth
and * so on
(end)
some other text here...
";
?>
And I want to extract what's between (start) & (end) and put the result into a new variable.
The fallowing code is only working when all the data on the same line!
PHP Code:
if (preg_match("/\(start\)(.+?)\(end\)/", $content, $match))
{
print $match[1];
}
Thanks in advance.
|