PHP preg_replace: how to replace text between tags?
I have a function doit() that transforms text that way:
I like berries -> I LikE BerrieS.
And I need it to work with html-text to. How can I transform text only between html tags? Don't touch tag name and all tag attributes. E.g. I need:
<p >I LikE BerrieS</p>
but not:
<P ClasS="SupeR GreeN" StylE="HeighT: AutO">I LikE BerrieS</P>
I've tried simple preg_replace() patterns, but nothing worked. I'm new to regexp and need help.
May be preg_match() would be better? Any suggestions? It would be nice to provide working php-code.
Answer
Solution: