$pattern="'(" .$pre.")(.?)(" .$end .")'si";
//$pattern is '(.?<body>)(.?)(</body>.?)'si
preg_match($pattern, $content, $matches);
Basically I want to analyze a website content. I want to split the content into 3 part. The one above <body>, the body inner html, and the on below </body>
The <body> is expected to be found. So it's not going to be <body bla bla onclick=> something. It has to be <body>. I made sure of it for simplicity.
I wonder why often it doesn't work.
Also I wonder why I wrote .? shouldn't it be .?