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?

[Webinar] Streamline your web hosting managementRegister Today

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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
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
All Courses

From novice to tech pro — start learning today.