문제

I would like to write simple regexp with Qt QRegExp

I want to fetch all substring of a Qstring with table(i, d), without the quotes, with i "hard written" and d representing any integer. And then using cap, to retrieve value for d. I propose

 qREgExp reg ( "table(i,\\s*(\\d+)\\s*)") ;

I cherrish the hope that then

 reg.cap(2)

gives me the d in question here.

How would you put it?

도움이 되었습니까?

해결책

Try to use

qREgExp reg ( "\\btable\\(i,\\s*(\\d+)\\s*\\)" );

with

reg.cap(1) 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top