Re: need some regex help to strip out // comments but not http:// urls
| From: | Andreas Perstinger | Date: | Wed, 29 May 2013 06:10:28 +0000 |
| Subject: | Re: need some regex help to strip out // comments but not http:// urls | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321225@lists.php.net to get a copy of this message | ||
On 28.05.2013 23:17, Daevid Vincent wrote:
I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief. I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs...You need a negative look behind assertion ( http://www.php.net/manual/en/regexp.reference.assertions.php ). "(?<!http:)//" will match "//" only if it isn't preceded by "http:". Bye, Andreas