Re: need some regex help to strip out // comments but not http:// urls
| From: | Jonesy | Date: | Wed, 29 May 2013 13:57:57 +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-321229@lists.php.net to get a copy of this message | ||
On Tue, 28 May 2013 14:17:06 -0700, 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...
KISS.
To make it simple, straight-forward, and understandable next year when I
have to re-read what I've written:
I'd change all "://" to "QqQ" -- or any unlikely text string.
Then I'd do whatever needs to be done to the "//" occurances.
Finally, I'd change all "QqQ" back to "://".
Jonesy