You will run into more problems and there are many things you need to consider, for example "/*" in a string. But token_get_all() will parse php code for you and will make things much simpler.


zzz wrote:
I'm trying to strip comments out of my code.  I can get it to strip one
section of comments but the problem comes in when I have more then one
comment section to strip.

I am using this: $code = preg_replace('/\/*(.*?)*\//is', '$1', $code) and
need help fixing my regex.


example: ========

code 1

/* comment 1 */

code 2

/* comment 2 */

code 3

result (bad):
=============

code 1

code 3

result (good):
==============

code 1

code 2

code 3


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to