Remove PHP comments using Dreamweaver Regexes

Hello,

I need to remove all of the comments in a php file that is over 4000 lines long.

The comments consist of both types /**/ and //

I have a regular expression for the /**/ part :- [code sec below]

How can i remove the // comments from the document using Dreamweavers (unix like) regexes?
/\*[\S\s]+?(?=\*/)\*/

Open in new window

LVL 4
wilson1000Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ddrudikConnect With a Mentor Commented:
Tested with DW CS4:
(?:^|\n)[^\S\r\n]*(?://[^\r\n]*|/\*(?:(?!\*/)[\S\s])*\*/[^\r\n]*)

Open in new window

0
 
wilson1000Author Commented:
Unfortunately, this crashes Dreamweaver CS3 - I haven't moved over to CS4 as yet because of the transition with plugins.

When the regexe runs it clears only some of the comments but looks as though it gets stuck.

What would cause this?

0
 
ddrudikCommented:
Not sure, if you can attach a .txt file example of what crashes CS3 I can try it with CS4.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
wilson1000Author Commented:
Thank you ddrudik, file attached...

php-comments.txt
0
 
wilson1000Author Commented:
Sorry, this isn't enough code please bear with me a second...
0
 
wilson1000Author Commented:
... try this one ...

php-comments.txt
0
 
ddrudikCommented:
267 replacements made in CS4.
php-comments.txt
0
 
wilson1000Author Commented:
Cool, so it works in CS4.

How do you find CS4 in comparison to CS3?
0
 
ddrudikCommented:
I moved from MX2004 to CS4 so I don't have experience with CS3.  I haven't found anything with CS4 that I dislike but I code more than I design.

Thanks for the question and the points.
0
 
wilson1000Author Commented:
No trouble, same here from the coding angle - much cleaner & quicker.

Take care
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.