views:

29

answers:

2

I would like to use preg_replace to replace "* @license until */" with "testing".
How can I do it?
My text is the one below:

/*
 * @copyright  
 * @license  
 *
 */

I hope everyone have understand my question correctly.

A: 

Well, it's not too hard. All you need to do is use the s modifier (PCRE_DOT_ALL, which makes a . in the regex match new lines):

$regex = '#\\*\\s*@license.*?\\*/'#s';
$string = preg_replace($regex, '*/', $string);

That should work for you (note, untested)...

ircmaxell
A: 
Tomalak