Source Insight中使用正则表达式进行高级替换

        问题描述:

        代码中有个断言函数,假设叫MyAssert,只有一个参数,用法例如:

MyAssert(a > 0);
MyAssert(b <= MAX_LINE_NUM);
MyAssert((NULL != pNode) &&  (NULL != pNode->pNext));

        现在想给MyAssert增加一个参数。假设所有调用处都加一个参数100,即修改为:

MyAssert(a > 0, 100);
MyAssert(b <= MAX_LINE_NUM, 100);
MyAssert((NULL != pNode) &&  (NULL != pNode->pNext), 100);

        则在Source Insight中替换时,选中使用正则表达式。搜索内容填写为:

        MyAssert\(.+\));

        替换后的内容填写为:

        MyAssert\1 ,100);

        这样即可。

猜你喜欢

转载自blog.csdn.net/missgya/article/details/20654035