<div class="hello">
<span>Hello World<span>
<div>
I need to get all content inside the div.
I tried this way, but I can not get:
<div class="hello">
<span>Hello World<span>
<div>
I need to get all content inside the div.
I tried this way, but I can not get:
Use the following:
/(<div class="hello">){1}(.)*(<\/div>){1}/is
The 's' flag allows the dot (.) to match newline. Then you will get the three groupings that you desire.
See https://regex101.com/r/dlrbhM/2 for a live example