正则表达式替换 Doxigen 块注释 [已关闭]

问题描述 投票:0回答:0

我正在尝试将(在 #python 中用 #regex )以 /// 开头的 Doxygen 注释块替换为看起来像 R&K 注释的块:

/// @name ...
/// @{
/// @brief

/**
 * @name ...
 * @{
 * @brief
 */

我不知道如何识别多行块以保留它并替换和添加其余部分?

类似的东西

import re

# example /// text
text = """
/// body 0
/// body 1
/// @param x 
"""

pattern = r'///\s*(.*?)\n'

# /// --> /** ... */
result = re.sub(pattern, 
r'/**\n\1\n*/\n', text)
#
print(result)
regex multiline
© www.soinside.com 2019 - 2024. All rights reserved.