"Daniel Tryba" <partmapsswen@invalid.tryba.nl> schreef in bericht
news:424133d0$0$155$c5fe704e@news6.xs4all.nl...[color=blue]
> In comp.lang.php Rob <reply@newsgroup.nl> wrote:[color=green]
>> If I have the following code fragment:
>> /*
>> comment bla bla
>> */
>> ...code...
>>
>> With a regular expression, how do I get/extract the comment inside this
>> multi line comment block. With and without the comment characters?
>> And how do I get all the multi line comment from in the entire script?
>> (yes I have red the documentation, but obviously this wasn't enough
>> -) )[/color]
>
> What documentation did you read? AFAIK there is mention of a multiline
> flag in the preg section. So all you do need to do is do a nongreedy
> multiline match for /\/\*.*?/*///.
>
> FUP comp.lang.php
>[/color]
Thanks for the fast reply,
I red the docs on the
www.php.net
I used it in the following code:
$code=<<<end_of_code
/**
* comment 1
*/
codeblock 1
/**
* comment 2
*/
codeblock 2
end_of_code;
$pattern='/\/\*.*?/*///';
if (preg_match($pattern,$code,$array=array())){
print_r($array);
}
I receive the following error:Warning: Unknown modifier '*' in
What do i do wrong?
Thanks Rob