I have a CMS with a WYSIWYG editor which produces pretty good xhtml. Based on this fact, I think a HTML parser might be slightly overkill for this small job.
I am intending to use regular expressions but so far have been unable to get mine to match what I’m after.
I’m using PHP5.
I need to match the content of the 3 block level elements the WYSIWYG editor is able to produce: p, ul & ol. I am using preg_match_all() currently.
Is anyone able to help me?
Thank you
This should work as long as you don’t have nested p/ul/ol tags:
?:prevents anything in the parens from being included in$matchesand.*?prevents the regex from matching past the end of another tag.