First off, I'm aware this is a bad practice and I have answered many questions even saying so, but to clarify I am forced to use regex because this application stores regexes in a database and only functions this way. I absolutely cannot change the functionality
Now that we got that out of the way.. because I always use DOM methods I'm not used to doing this with regular expressions.
I want to capture everything inside of the intro content division, up to the first end div tag. I don't care if the regex will fail on nested divs. I need to capture space ( newline ) characters too.
<div class="intro-content">
<p>blah</p>
<br/>
<strong>test</strong>
</div>
Regex so far:
<div\s*class="intro-content">(.*)</div>
This obviously doesn't work because the .
character will not match space characters.
I do realize there have been hundreds of question asked, but the questions I visited only had relatively simple answers ( excluding the DOM suggestion answers ) where a (.*)
would not suffice because it doesn't account for newlines, and some regexes were too greedy.
I'm not looking for a perfect, clean solution that will account for every possibility ( like that's even possible ) - I just want a quick solution that will work for this solution so I can move on and work on more modern applications that aren't so horribly coded.