I'm trying to get a text from webpage with regular expression, text is in this form <h1><a href="url1">title1</a></h1> <em>something</em> <p>Here is some text #1 multiline</p> <p> <div class="details"><a href="url1">more...</a></div> </p> <h1><a href="url2">title2</a></h1> <em>something</em> <p>Here is some text #2 multiline</p> <p> <div class="details"><a href="url2">more...</a></div> </p> HTML: I tried to match this code: '/<h1><a href="(.*)">(.*)<\/a><\/h1>\s+<em>(.*)<\/em>\s+<p>[COLOR="Red"][B]((.|\n)*<\/p>)[/B][/COLOR]\s+<p>\s+<div class="details"><a href="(.*)">more...<\/a><\/div>\s+<\/p>/' Code (markup): but this part ((.|\n)*<\/p>) matches everything from <p> in first article all the way to </p> in the last article, but I want to grab only text: Here is some text #1 multiline Can somebody help me please