[英]removing php comments with replace tool using regex in phpstorm
How do I remove multiline comments from php files with regex? 如何使用正则表达式从php文件中删除多行注释? I tried "/\\*(.*\\n)*\\*/" but it fails.
我试过“/\\*(.*\\n)*\\*/”但它失败了。 All it does is starts with "/*" and stops at the last occurrence of "*/".
它只是以“/ *”开头,并在最后一次出现“* /”时停止。
Thanks to the tenub comment. 感谢tenub评论。
The final solution for all php comments looks like this: 所有php评论的最终解决方案如下所示:
/\\*[\\s\\S]*?\\*/|(?<!http:)//.*
Where 哪里
1) /\\*[\\s\\S]*?\\*/
for /*comments*/
1)
/\\*[\\s\\S]*?\\*/
for /*comments*/
2) (?<!http:)//.*
for single line //comment
escaping urls starting with http://
(it would be better to prevent the ones preceded by "
or '
from showing but I'm good for now) 2)
(?<!http:)//.*
用于单行//comment
转义的URL以http://
开头(最好防止以"
或'
开头的那些显示,但我现在很好)
Oh and tenub if you post a corrected answer instead of the comment. 如果您发布更正后的答案而不是评论,那么哦和tenub。 I'll accept it.
我会接受的。 Cos you helped ty)
你有没有帮助ty)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.