# Regular expressions replace any character or newline

**URL:** <https://forum.kirupa.com/t/regular-expressions-replace-any-character-or-newline/311936>\
**Category:** Uncategorized\
**Created:** [July 20, 2010, 8:27pm UTC](https://forum.kirupa.com/t/regular-expressions-replace-any-character-or-newline/311936 "2010-07-20T20:27:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dataxa](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dataxa](https://forum.kirupa.com/u/dataxa)\
**Post date:** [July 20, 2010, 8:27pm UTC](https://forum.kirupa.com/t/regular-expressions-replace-any-character-or-newline/311936/1 "2010-07-20T20:27:09Z")

</div>

I need to replace all comments on file.

Comment structures are like this:

```php
/*
here is comment
*/

```

Currently i have this line of code which should do the trick but its not:

```php
$newcont = preg_replace("//\*(
*|.*)\*//" , "" , $oldcontent);

```

Meaning: /\* here any character OR new line \*/

Can anyone please help me.
