Perhaps, this code is working well:
I checked for few URIs, it done well. Though not sure! I'm trying more URIs ..
Can some one tell me, why results of preg_match_all() is in 2-dimensional array. I noted all the times, $matches is only useful. Why other ones are vague?
In emample above, I couldn't undertand U and ^ modifiers!
If $ is a match at end-modifier, why putting $pattern = "/(<script)(.*)(<\/script>$)/i"; in this code, makes the result array null?
I'm a regex novice. I've one last question: Is using lenghty regex slows the script. I mean, is there some efficieny concern, while using regexs or PHP Perl-compatible regex functions?