ReGex is new here.
I need to remove two different style comments from PHP files using RegEx.
I found this expression to run in the BBEdit text editor:
\/\*[\s\S]*?\*\/
and removes comments in the first style, as shown below:
/** This comment gets removed with my regex */
But he does not remove these style comments:
// ** This comment has the double leadng-trailng slashes ** //
I don’t know why there is a combination of two different types of comments, and there are only a few comments //, but I need to delete all of them.
Adding another slash to the search, i.e.
\/\\*[\s\S]*?\*\/
makes the expression greedy and removes individual slashes in uncommented code. A working expression will require much more complexity :)
source
share