【问题标题】:Powershell - Remove C++ comments from file [duplicate]Powershell - 从文件中删除 C++ 注释 [重复]
【发布时间】:2015-04-09 13:59:15
【问题描述】:

我是 powershell 新手,需要一些帮助。我想使用 replace 函数从 C++ 源代码中删除所有 cmets。也就是单行和多行 cmets:

/*
    Comment here.
*/

// Comment here.

有人可以为此使用 powershell 正则表达式吗?

【问题讨论】:

标签: regex powershell replace comments


【解决方案1】:

看看这个answer。

在 Powershell 中,您也可以使用 Regex.Replace,但方式略有不同:

[regex]::Replace($input, $pattern, $replacement)

【讨论】:

  • 太棒了。那行得通。
猜你喜欢
  • 1970-01-01
  • 2015-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多