Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > A program to replace all JS comments with JSP comments in jsp files

Reply
Thread Tools

A program to replace all JS comments with JSP comments in jsp files

 
 
tungchau81@yahoo.com
Guest
Posts: n/a
 
      06-02-2006
Hi,
I have a lot of JSP files that serve as pure JavaScript code. I need to
convert all JavaScript comments inside these JSP files to JSP comments
which use <%-- // --%> tags. Instead of doing it manually, I would
like to write a script/program that can detect the JS declarative
comment structure and replace it with the equivalent JSP comment.
However, I do not know how to start writing such kind of
script/program. I would appreciate alot if you can suggest me some
tool/program, Linux shell command or programming language (Perl,
JavaScript, ...) that I can use. Is there any available program out
there that is doing this task ?

Thanks in advance,
Tung Chau

 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      06-02-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Hi,
> I have a lot of JSP files that serve as pure JavaScript code. I need to
> convert all JavaScript comments inside these JSP files to JSP comments
> which use <%-- // --%> tags. Instead of doing it manually, I would
> like to write a script/program that can detect the JS declarative
> comment structure and replace it with the equivalent JSP comment.
> However, I do not know how to start writing such kind of
> script/program. I would appreciate alot if you can suggest me some
> tool/program, Linux shell command or programming language (Perl,
> JavaScript, ...) that I can use. Is there any available program out
> there that is doing this task ?
>
> Thanks in advance,
> Tung Chau


Hi Tung,

Well, what you are asking for is a straightforward search-replace alghoritm,
right?
Such tasks are easy with scriptinglanguages like PHP or Perl.
Even VB-script should be able to do it.

My Perl suck these days, so if you can go PHP, have a look at:
http://nl2.php.net/manual/en/function.str-replace.php
and fopen() for opening.

try to make a program that opens all files, replaces your commentstags, and
then safes the file.

Regards,
Erwin Moller
 
Reply With Quote
 
 
 
 
Hal Rosser
Guest
Posts: n/a
 
      06-02-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi,
> I have a lot of JSP files that serve as pure JavaScript code. I need to
> convert all JavaScript comments inside these JSP files to JSP comments
> which use <%-- // --%> tags. Instead of doing it manually, I would
> like to write a script/program that can detect the JS declarative
> comment structure and replace it with the equivalent JSP comment.
> However, I do not know how to start writing such kind of
> script/program. I would appreciate alot if you can suggest me some
> tool/program, Linux shell command or programming language (Perl,
> JavaScript, ...) that I can use. Is there any available program out
> there that is doing this task ?
>
> Thanks in advance,
> Tung Chau
>


That wheel has already been invented.
You can google to find a shareware to search/replace through an entire
directory.
Its been several years since I used one, so the name of the one I used has
departed the memory banks.
But look at it as a find-replace task, heck, even MS Word can do that for a
file at a time.
HTH Hal


 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      06-02-2006
(E-Mail Removed) wrote:
> Hi,
> I have a lot of JSP files that serve as pure JavaScript code. I need to
> convert all JavaScript comments inside these JSP files to JSP comments
> which use <%-- // --%> tags. Instead of doing it manually, I would
> like to write a script/program that can detect the JS declarative
> comment structure and replace it with the equivalent JSP comment.
> However, I do not know how to start writing such kind of
> script/program. I would appreciate alot if you can suggest me some
> tool/program, Linux shell command or programming language (Perl,
> JavaScript, ...) that I can use. Is there any available program out
> there that is doing this task ?
>

man find
man sed

--
Ian Collins.
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      06-03-2006
JRS: In article <OA0gg.68663$(E-Mail Removed)>, dated
Fri, 2 Jun 2006 15:46:56 remote, seen in news:comp.lang.javascript, Hal
Rosser <(E-Mail Removed)> posted :
>
>That wheel has already been invented.
>You can google to find a shareware to search/replace through an entire
>directory.


Why go to that expense? See in sig.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelight.net/minitrue/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer 8: C:\Program Files\Internet Explorer\iexplore.exe vs C:\Program Files (x86)\Internet Explorer\iexplore.exe Nathan Sokalski Windows 64bit 16 02-22-2010 08:31 AM
How to replace c:\Program Files with Program Files (x86) in allscripts? clearguy02@yahoo.com Perl Misc 5 05-15-2009 02:23 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
A program to replace all JS comments with JSP comments in jsp files tungchau81@yahoo.com Java 0 06-02-2006 06:35 AM
Program Files vs Program Files x86 =?Utf-8?B?QklHRQ==?= Windows 64bit 2 02-14-2006 08:26 PM



Advertisments