小编Mar*_*tin的帖子

匹配 C 多行预处理器语句的正则表达式

我需要的是匹配多行预处理器的语句,例如:

#define max(a,b) \
       ({ typeof (a) _a = (a); \
           typeof (b) _b = (b); \
         _a > _b ? _a : _b; })
Run Code Online (Sandbox Code Playgroud)

重点是匹配#define和 last之间的所有内容}),但我仍然不知道如何编写正则表达式。我需要它才能使用“re”模块在Python中工作。

有人可以帮我吗?

谢谢

python regex

4
推荐指数
1
解决办法
1045
查看次数

标签 统计

python ×1

regex ×1