# Regular expression - new line

**URL:** <https://forum.kirupa.com/t/regular-expression-new-line/272335>\
**Category:** Uncategorized\
**Created:** [October 4, 2008, 3:31am UTC](https://forum.kirupa.com/t/regular-expression-new-line/272335 "2008-10-04T03:31:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [October 4, 2008, 3:31am UTC](https://forum.kirupa.com/t/regular-expression-new-line/272335/1 "2008-10-04T03:31:08Z")

</div>

I’m scraping an HTML page and need to extract the text inside a div with class “comment\_body”. My code prints out an empty array. I seem to not know how to handle newlines.

```php

<?php
	$html = '<div class="comment_body">That\'s what I was thinking, Tight. The \'Noooo\' is the only way to add a funny narrative. It\'s in \'big\' pixels so I can\'t create an meaningful expression and it\'s practically impossible to do anything else without distrupting the whole concept. I think the \'Nooo\' works, anyway. I\'ve done it in pixels to the width of the snake, so it fits withing the grid.<br />
<br />
I know exclaimation marks can look a bit cheap, but I think the two work in this context.</div>';

	preg_match_all('#class="comment_body">([.
]*)<\/div>#', $html, $found);
	
	print_r($found);
?>

```
