the patern is like so
/* comment [comment goes here] */
/* comment please do not delete the lines below */
[I am a special line so I should not be changed ]
/* comment please do not delete the line above */
I would like to remove the comment blocks, but instead of looking for /**/
I would like the comment to be /* comment [] */
where []
is the actual comment.
This is to avoid any text that should include comments.
so here are the conditions of the comment
- starts with =>>
/* comment
- followed by =>> anything
- followed by =>>
*/
Seems to do the job :)
preg_replace("(\\/\\*[\s]*?comment[\\d\\D]*?[\s]*?\\*\\/)",'',$str)
How I found out ?
well this website is just tooooo amazing :)
http://txt2re.com/index.php3
This removes the comment blocks:
And this get's rid of obsolete whitespace as well:
Here's a test script:
Output with PHP 5.3.4: