Link to home
Start Free TrialLog in
Avatar of wilson1000
wilson1000

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wilson1000
wilson1000

ASKER

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?

Not sure, if you can attach a .txt file example of what crashes CS3 I can try it with CS4.
Thank you ddrudik, file attached...

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

php-comments.txt
267 replacements made in CS4.
php-comments.txt
Cool, so it works in CS4.

How do you find CS4 in comparison to CS3?
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.
No trouble, same here from the coding angle - much cleaner & quicker.

Take care