Removing php comments with replace tool using regex in phpstorm

How to remove multi-line comments from php files using regular expressions? I tried "/\*(.*\n)*\*/" but it fails. Everything he does starts with "/ *" and stops when "* /" last appears.

+4
source share
1 answer

Thanks to the comments of tenub.

The final solution for all php comments is as follows:

/\*[\s\S]*?\*/|(?<!http:)//.*

Where

1) /\*[\s\S]*?\*/for/*comments*/

2) (?<!http:)//.* //comment URL-, http:// ( , " ', )

, tenub, . . ty)

+5

Source: https://habr.com/ru/post/1534702/


All Articles