[EMAIL PROTECTED] (Diane Holt) wrote:

> --- Duncan Harris <[EMAIL PROTECTED]> wrote:
> > I've just knocked up an Ant Task to strip comments from JavaScript
> > files. Useful in web apps so you can comment to your hearts delight
> > without using up runtime bandwidth.
> > 
> > Would this be useful to others, or is there some component out there
> > that already does this which I missed in my quick search?
> 
> I should think <replaceregexp> (available in the nightlys, until 1.5 comes
> out) could do that.

OK I'll take a look. Although it requires a couple of passes and the regexp
for the main pass is fairly hairy. Substitution would be something like:

(?ms)("(?:\\"|[^"\r\n])*"|'(?:\\'|[^'\r\n])*')|//.*?$|/\*.*?\*/

for $1

Then you need another pass to get rid of blank lines
and then another pass if you want to rid excess space.

How stable is the 1.5 alpha nightly?
I just tried to get the latest and it didn't build in SunJDK 1.3.1.

Duncan Harris
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hartford, Cheshire, U.K., Tel: 07968 060418

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to