I can't seem to get this to work and I was hoping for some help.
I'm trying to capture the contents of a specific div
(please save the DOM talk, for this specific purpose it doesn't really come into play.)
The problem is, I can't seem to get it to work if there is another div
with attributes before it on the same line. I tried specifying only match if there's no >
between <div
and class="myClass"
, but I think I'm doing it wrong.
I'm still pretty mystified by regex.
/<div(?!>).*?class="myClass".*?>(.*?)<\/div>/mi
(semi) Working example: http://regex101.com/r/cW0lW6