kepler has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I'm trying to make a simple perl code that reads a code file and removes all comments (javascript style), like //... or /*... */ and /*....new line (number of time unknown)
Can someone give me an hand? Removing patterns like // or /*...*/ can be done, I think, with /\/+\*?\.*/gi but there are weird things on a random code. For instance, line breaks or the lines beginning with spaces or tabs. So I could do /([\ |\t]*)\/+\*?\.*/gi perhaps
Best regards
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comments regex
by haukex (Archbishop) on Feb 25, 2020 at 09:52 UTC | |
by kepler (Scribe) on Feb 25, 2020 at 10:44 UTC | |
|
Re: Comments regex
by cavac (Prior) on Feb 26, 2020 at 12:15 UTC |