I have a html string. In that I defined some 开发者_C百科area for editing. That area enclosed in certain comment. I want to get all the content between that comment. For example
<!--start--> some content with any html tag <!--end-->
In the above example I need the content between the start and end tag. That is want
some content with any html tag
.
-Arun
$string = '<!--start--> some content with any html tag <!--end-->';
preg_match('/<!--start-->(.*?)<!--end-->/', $string, $matches);
var_dump($matches);
$string = '<!--start--> some content with any html tag <!--end-->';
echo preg_replace('/<!--start--> (.*) <!--end-->/', '$1', $string);
精彩评论