Use REGEX to replace X(…) with X{…}

后端 未结 1 1591
Happy的楠姐
Happy的楠姐 2021-01-24 07:21

The problem comes from updating code to C++11, which uses initialisers.

So:

a = X(4);
b = X();
c = X( (1+2)*(3+4) );
void P : X(5) { foo(); }
         


        
1条回答
  •  独厮守ぢ
    2021-01-24 07:49

    This is because the operators * and + are greedy. However, you can enforce laziness by using the expression

    X\((.*?)\);
    

    The ? Symbol enforces a lazy match.

    0 讨论(0)
提交回复
热议问题